2. About Me
陳俊毅 (Levi Chen)
Engineer in Common Service & Infra Team @ 91APP
Contact me
● FB: https://fb.me/chenjiunyi
● Blog: https://blog.levichen.tw
2
3. Responsibilities @ 91APP
● Develop 3 common services
○ Product, Notification and Rate Limiter
● Help RDs to use cloud technologies
○ Cloud Native, Serverless
● Help architecture team to implement new policies
About Me
3
22. The Complexity of Deployment
=
Number of Environments
x
Number of Services
x
Number of Instances
x
Number of Configurations22
23. If we have 10 environments, 40 services, 2 instances, 20
configuration…
10 environments x 40 services x 2 instances x 20 configuration
= 16,000 configurations
23
45. Everyone could use artifacts to build services everywhere,
by different configurations
https://www.sc.qa/en/news/2022-fifa-world-cup-stadium-workers-given-5m-repayment45
61. ● Command line interface for building configuration hierarchy
● Test for Configuration
● JSON -> Key-Value pairs
● Build and deploy configuration to 3 types of storages
○ Local files
○ Consul
○ S3
Cfgctl
61
62. Play with cfgctl: For developer in local environment
Local
Files
Configuration
Local
Consul
Cfgctl build for
local files
Cfgctl build for consul
CodeSDK
62
63. Play with cfgctl: For OOO Environment
S3
Configuration
Consul
Cfgctl build for S3
Cfgctl build for
consul
ServiceASDK
ServiceBSDK
63
75. 75
Service A
Service
Registery
Service B
#1
Service B
#2
Service A
Service
Registery
Service B
#1
Service B
#2
Hi, I am Service B (register)
Hi, I still alive (send heartbeat)
I want to call Service B
Service B has a Instance #1
76. 76
Service A
Service
Registery
Service B
#1
Service B
#2
Service A
Service
Registery
Service B
#1
Service B
#2
Hi, I am Service B (register)
Hi, I still alive (send heartbeat)
I want to call Service B
Service B has a Instance #1
Call Service B Instance #1
77. 77
Service A
Service
Registery
Service B
#1
Service B
#2
Service A
Service
Registery
Service B
#1
Service B
#2
Hi, I am Service B (register)
Hi, I still alive (send heartbeat)
I want to call Service B
Service B has a Instance #1
Call Service B Instance #1
Hi, I am Service B (register)
78. 78
Service A
Service
Registery
Service B
#1
Service B
#2
Service A
Service
Registery
Service B
#1
Service B
#2
Hi, I am Service B (register)
Hi, I still alive (send heartbeat)
I want to call Service B
Service B has a Instance #1
Call Service B Instance #1
Hi, I am Service B (register)
Hi, I still alive (send heartbeat)
82. 82
Service A
Service
Registery
Service B
#1
Service B
#2
Service A
Service
Registery
Service B
#1
Service B
#2
I want to call Service B
Service B has a Instance #1, #2
Call Service B Instance #2 (50%)
I wanna to leave (deregister)
83. 83
Service A
Service
Registery
Service B
#1
Service B
#2
Service A
Service
Registery
Service B
#1
Service B
#2
I want to call Service B
Service B has a Instance #1, #2
Call Service B Instance #2 (50%)
I wanna to leave (deregister)
I want to call Service B
84. 84
Service A
Service
Registery
Service B
#1
Service B
#2
Service A
Service
Registery
Service B
#1
Service B
#2
I want to call Service B
Service B has a Instance #1, #2
Call Service B Instance #2 (50%)
I wanna to leave (deregister)
I want to call Service B
Service B has a Instance #2
85. 85
Service A
Service
Registery
Service B
#1
Service B
#2
Service A
Service
Registery
Service B
#1
Service B
#2
I want to call Service B
Service B has a Instance #1, #2
Call Service B Instance #2 (50%)
I wanna to leave (deregister)
I want to call Service B
Service B has a Instance #2
Call Service B Instance #2
87. Multiple tenancies infrastructure in client-side service discovery
https://www.nginx.com/blog/service-discovery-in-a-microservices-architecture/
VIP
VIP
Normal
87
94. Environment 1
AM
CI Server
CMService
Environment 2
CI Server
CM
0. Build Config
By Cfgctl
0. Build Code
Service
S
D
K
S
D
K
94
1. Get Metadata
1. Get Metadata
Service Name, Version, AM, CM, etc..
Service Name, Version, AM, CM, etc..
95. Environment 1
AM
CI Server
CMService
Environment 2
CI Server
2. Get Artifact
2. Get Artifact
CM
0. Build Config
By Cfgctl
0. Build Code
Service
S
D
K
S
D
K
95
1. Get Metadata
1. Get Metadata
Service Name, Version, AM, CM, etc..
Service Name, Version, AM, CM, etc..
96. Environment 1
AM
CI Server
CMService
Environment 2
CI Server
3. Get Config
2. Get Artifact
2. Get Artifact
CM
0. Build Config
By Cfgctl
0. Build Code
3. Get ConfigService
S
D
K
S
D
K
96
1. Get Metadata
1. Get Metadata
Service Name, Version, AM, CM, etc..
Service Name, Version, AM, CM, etc..
97. Service Provisioning
● Build code and configuration
● Get Metadata
● Get Artifacts
● Get Confugration
● Run Service
97
103. ● Arch Team
○ Design
○ Configuration SDK
■ Easy to change configuration storages
■ Cache
■ Hotreload
■ Service Registration
Consider what you can contribute to teams and
minimize the impact on them
103
104. Consider what you can contribute to teams and
minimize the impact on them
104
● Infra Team & Common Service Team
○ PoC / Provision / Maintain Configuration Storage
○ Consider network topology / security
○ Build tools: Cfgctl
■ Resolve level configuration issue
○ Use it in our own services first