Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is not a very thorough article. It is more a critique on rate limiting approaches and difficulty, for the author, in implementing them with Redis.

Here is an excerpt from the token bucket section:

> It seems there’s no way to do a token bucket with the main Redis primitives such as SET, EXPIRE, and INCR. It would require two variables and the client has to read one before choosing how to update the second, which would require pausing the whole database while a client carries this out. So what people do is execute code in Redis. This is done using modules or scripts. Using a module here is dubious: You’re now just loading a C program (shared library) into Redis; why not just load it into an actual computer? So let’s look at “scripts” instead. Scripts are pieces of Lua code executed in Redis.

shows brief example

> Now it’s probably time to ask ourselves why we are here. We wanted a rate limiter and now we’re learning a niche programming language just to execute some code in a database that has nothing relevant to our task but a roundabout way of storing an int into RAM. This concludes my quest to discover how or why rate limiters are implemented in Redis.

This highlights the overall technical depth of the article and should inform you of how authoritative it should be considered.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: