← Quiz: Design a Rate Limiter: all 15 questions
Quiz: Design a Rate Limiter · Question 13 of 15
Why is a token-bucket update run as a Lua script inside Redis?
Why is a token-bucket update run as a Lua script inside Redis?
- A.Lua is faster than Python on every machine
- B.Redis cannot store numbers otherwise
- C.It encrypts the counters
- D.The read, compute and write happen atomically, so no other request can slip in between
Answer & explanation
Correct answer: The read, compute and write happen atomically, so no other request can slip in between
Two separate calls would let concurrent requests both see the old value.
Can you get the rest right without peeking?
Take the timed Quiz: Design a Rate Limiter quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →