Skip to content

Commit

Permalink
fix wrong usage of stateless
Browse files Browse the repository at this point in the history
  • Loading branch information
preslavmihaylov authored Sep 2, 2024
1 parent f6cbc18 commit 807039c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion system-design/system-design-interview/chapter05/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ In case of race conditions, the counter might not be updated correctly when muta
Locks are a typical way to solve this issue, but they are costly.
Alternatively, one could use Lua scripts or Redis sorted sets, which solve the race conditions.

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.
If we maintain user information within the application memory, the rate limiter is stateful and we'll need to use sticky sessions to make sure requests from the same user is handled by the same rate limiter instance.
![synchronization-issue](images/synchronization-issue.png)

To solve this issue, we can use a centralized data store (eg Redis) so that the rate limiter instances are stateless.
Expand Down

0 comments on commit 807039c

Please sign in to comment.