System design URL shortener: Spring Boot 4.1.1, base62 ids, Redis cache-aside, Redis Lua token bucket, 24 tests and live transcripts
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
capacity 5, refill 0.5 tokens/second (one every 2 s)
|
||||
request 1 -> HTTP/1.1 201 X-RateLimit-Remaining: 4
|
||||
request 2 -> HTTP/1.1 201 X-RateLimit-Remaining: 3
|
||||
request 3 -> HTTP/1.1 201 X-RateLimit-Remaining: 2
|
||||
request 4 -> HTTP/1.1 201 X-RateLimit-Remaining: 1
|
||||
request 5 -> HTTP/1.1 201 X-RateLimit-Remaining: 0
|
||||
request 6 -> HTTP/1.1 429 X-RateLimit-Remaining: 0 Retry-After: 2
|
||||
request 7 -> HTTP/1.1 429 X-RateLimit-Remaining: 0 Retry-After: 2
|
||||
$ redis-cli HGETALL rl:127.0.0.1
|
||||
tokens
|
||||
0.046000000000000082
|
||||
ts
|
||||
1792656760797
|
||||
--- sleeping 2.2 s
|
||||
request 8 -> HTTP/1.1 201 X-RateLimit-Remaining: 0
|
||||
--- redirects are not limited: 30 GETs in a row
|
||||
302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302 302
|
||||
Reference in New Issue
Block a user