Rate limiter
Watch a token bucket let requests in or turn them away. Change the limits and see what gets through.
How it works
- 1A token bucket holds a fixed number of tokens. Each request spends one. Tokens refill at a steady rate.
- 2If the bucket is empty, the request is rejected with 429 Too Many Requests. That keeps one noisy client from using up the whole server.
- 3The bucket size decides how big a burst you allow. The refill rate decides the long-run average.
Read the post: How to build an API for 100,000 requests a second
More demos
All demosQueryLite: a SQL database
A SQL database written from scratch — parser, B+ tree indexes, a query planner, joins and transactions — running live on 22,000 rows in your browser.
Raft consensus, live
The algorithm that keeps etcd and Kubernetes consistent. Five servers elect a leader and replicate a log — crash them and split the network while it runs.
Live collaborative editor
Real-time editing with no server. Three devices share a note — take one offline, edit everywhere, reconnect, and they merge. Open a second tab and it syncs live.