A simulation of the pass code system of china
There are some subsystems ( sub-services ):
Simulate the app using by people.
Simulate the app using by the Doctor and police in white suit (MIW).
Find which app server serves which individual and routing to it. In this version, we simply use the hash of id to find it. In real business it could hold by a set of bloom filter and a set of kv NO-SQL. This routing service must start after all the app server (4). the app server could return the request by the routing service let them route to next possible server, this mechanism ensures the routing service could extend horizontally.
since we never need to cross query across individual, it's very simple to extend the service horizontally. once a server starts, it read all trusted data from center database (5). once fully warmed, the server join the service to serve the query and modify the exist user's data and register a new patient.
This service has 4 sub service:
- individual data query. prepared string content the data Front Ends want inquire(1), (2). the query happens in memory.
- individual data modify. modifying happens in memory then persistent and queued sync to center database (5)
- LostAndFound service, deal with known exist but can't found in any app server. this service must offer stronger service than (1) and (2) to avoid domino effect. This service have the power to order any app server to (queued) dump data back to center database and re-warm.
- New Patient register.
- Operation APIs.
Holds trusted data. using traditional method to protect the service and the data.
...
...
...
To avoid attack, the gate check the requests and drop any unknown access. The gate service runs behind traditional anti-attack mechanism to offer 7 level filter.
ignoring the gate (9) in this diagram for a clear view,
graph TD;
subgraph services
Layer7Router-->AppAndData(App And Data);
AppAndData-- return -.->Layer7Router;
AppAndData-- queued -->CenterDatabase[(Center Database)]
CenterDatabase-->AppAndData
CenterDatabase-- queued -->InterSystemSync(Inter System Sync)
InterSystemSync-- queued -->CenterDatabase
end
subgraph front ends
PatientFrontEnd[Patient Front End]-->Layer7Router{Layer Seven Router};
OfficerFrontEnd[Officer Front End]-->Layer7Router;
AnalyzingAndBI-->CenterDatabase
Operation-->InterSystemSync
Operation-->AppAndData
Operation[operation interfaces]-->CenterDatabase
end
subgraph outer [outer system]
OuterServers-->InterSystemSync
InterSystemSync-->OuterServers
end