Confirmed users
927
edits
Tarek.ziade (talk | contribs) |
Tarek.ziade (talk | contribs) No edit summary |
||
Line 23: | Line 23: | ||
= Synchronous Architecture = | = Synchronous Architecture = | ||
[[File:Sync-effe-ouane.png]] | |||
The synchronous architecture is composed of two | The synchronous architecture is composed of two layers: | ||
* | * The front layer, which proxies calls to the back layer. Every request is routed to a back server. | ||
* | * The back layer, which calls the third-party service and return the response synchronously. | ||
Both front and back layer interacts with the '''Services Status DB''', a key/value storage global to the cluster that indicates the status of each service. | |||
Detailed transaction: | Detailed transaction: | ||
1. | 1. Zeus uses a X-Target-Service header that indicates which service is going to be called. For each service there's at least two servers that can be load balanced to receive requests. | ||
2. the | 2. The server checks in the Service Status DB if the service is up or down. If it's down, it returns immediately a 503 + Retry-after. The Retry-After value is provided by the Service Status DB. | ||
3. the server | 3. If the service is up, it proxies the request to one back-end server that is in charge of the service. There can be several back-end server and the front server uses a round-robin strategy. | ||
4. The back-end server proxies to the Gunicorn server, which picks a worker. | |||
5. The worker does the job and returns it. | |||
6. The worker pings the Service Status DB In order to indicate whether the request was a success or a failure. | |||
7. An admin application let Ops view the current status of the Services, but also shut down a specific service if needed. | |||
== Services Status DB == | |||
Each service has a '''(GR / BR)''' ratio stored in that DB. | |||
* GR = Number of good responses. | |||
* BR = Number of bad responses. | |||
What are "Good" and "Bad" responses is to the workers discretion. | |||
The DB also store a "disable" flag for each service, that can be toggled manually to shut down a service if needed. | |||
The DB is replicated in several places and is eventually consistent. | |||
== Failures == | |||
XXX describe the scenarios. | |||
= Asynchronous Architecture = | = Asynchronous Architecture = |