preslavmihaylov / booknotes

A collection of my book notes on various subjects, mainly computer science
MIT License
2.18k stars 469 forks source link

Typo "stateless" at system-design/system-design-interview/chapter05 #15

Closed ngocdaothanh closed 1 month ago

ngocdaothanh commented 1 month ago

Thank you for the wonderful notes! I'd like to suggest fixing a typo:

https://github.com/preslavmihaylov/booknotes/tree/master/system-design/system-design-interview/chapter05

Current text:

If we maintain user information within the application memory, the rate limiter is stateless and we'll need to use sticky sessions to make sure requests from the same user is handled by the same rate limiter instance.

I think it should be "stateful"?

preslavmihaylov commented 1 month ago

Hey thanks for the suggested fix! I believe it is stateless after all, because when the data is held in the application memory, it is not persisted anywhere or shared with other instances of the service/component.

ngocdaothanh commented 1 month ago

"stateless" means the state of the rate limiter is persisted outside the rate limiter. For example the state is in Redis, the rate limiter only contains logic, there's no state in it.

If the state is in the rate limiter (as in https://github.com/preslavmihaylov/booknotes/blob/master/system-design/system-design-interview/chapter05/images/synchronization-issue.png), it's "stateful".

preslavmihaylov commented 1 month ago

Ahh okay, now that I read the full paragraph, I understand and you are right - it was a mistake. Thanks for bringing this up, fixed now! :)