Reputation: 159
For cadence, history services is a ringpop so if a new history service is added into history services, each history service will know a new history service to join. But Frontend service need to route request to history service. How frontend service know there are one more history service to join?
Upvotes: 0
Views: 218
Reputation: 2391
It’s all done via ringpop. Cadence uses ringpop library for all services including history and frontend.
https://github.com/uber/ringpop-go
Ringpop provide a consistent hashing ring for sharding, request routing and host discovery.
In a Cadence cluster, All services would use the same ringpop bootstrap config like
That way, all services are using the same consistent hashing ring and they can reach any host of any service.
If you use the admin cluster describe command you can see Something like below:
cadence --address `hostname`:7933 adm cl d
{
"supportedClientVersions": {
"goSdk": "1.5.0",
"javaSdk": "1.5.0"
},
"membershipInfo": {
"currentHost": {
"Identity": "10.42.13.242:7933"
},
"reachableMembers": [
"10.42.13.254:7935",
"10.42.26.5:7939",
"10.42.18.213:7934",
"10.42.13.242:7933",
"10.42.27.210:7939",
"10.42.18.48:7933",
"10.42.18.153:7935"
],
"rings": [
{
"role": "cadence-frontend",
"memberCount": 2,
"members": [
{
"Identity": "10.42.18.48:7933"
},
{
"Identity": "10.42.13.242:7933"
}
]
},
{
"role": "cadence-history",
"memberCount": 1,
"members": [
{
"Identity": "10.42.18.213:7934"
}
]
},
{
"role": "cadence-matching",
"memberCount": 2,
"members": [
{
"Identity": "10.42.13.254:7935"
},
{
"Identity": "10.42.18.153:7935"
}
]
},
{
"role": "cadence-worker",
"memberCount": 2,
"members": [
{
"Identity": "10.42.27.210:7939"
},
{
"Identity": "10.42.26.5:7939"
}
]
}
]
}
}
Each host may work for different service but they all know each other.
The implementation code path is here if you are interested https://github.com/uber/cadence/blob/deb0caf06577be007046e5f96ef40bdf3c0bc728/client/history/client.go#L1178
Upvotes: 1