Sortable ids without a counter

  • Build
  • Scale 22

Difficulty 4 of 5

Apps in 3 regions need 100,000 new ids/s. Ids must be unique and sort by creation time to within 1 s. Each id needs p99 under 20 ms, under 0.1 percent errors, at most 80 USD/mo. The clock in one region runs 300 ms ahead.

Play level

RegionRegionRegionHTTP/2HTTP/2HTTP/2HTTP/2HTTP/2Users33,334 req/sAPI server3 vCPU · 1 GBUsers33,334 req/sAPI server3 vCPU · 1 GBUsers33,334 req/sAPI server3 vCPU · 1 GBKey-value…8 vCPU · 1 GB
HTTP/2HTTP/2HTTP/2UsersAPI s…UsersAPI s…UsersAPI s…Key-v…
The board at the start of the level
A lease with a fencing tokenTap to turn the fencing tokens on or off

Fencing tokens · lease 30 s · late write with token 33: rejected

Goals and limits

Duplicate IDs
none
ID order error
under 1 s
p99 latency (*)
under 20 ms
Error rate (*)
under 0.1%
Monthly cost
under 80 USD/mo
Parts you can add
Key-value store, Postgres, API server
Part limit
7
Traffic
33,334 req/s

Concepts

How players did

Player results load from the server.