Open
Description
openedon Oct 12, 2022
I noticed RateLimiter recently and had a question in the ‘com.google.common.util.concurrent.RateLimiter#acquire(int)’ method。
What I want to ask is the performance issue of synchronized (mutex()) in reserve method.
If there are 10,000 requests to synchronize (mutex()) to compete for locks, then the semantics of synchronized will cause these requests to block here, which may cause lock escalation and eventually become heavyweight locks. Why not use optimistic locking to deal with it?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment