guava
guava copied to clipboard
Lock contention performance issues:com.google.common.util.concurrent.RateLimiter#acquire(int) -->reserve()#synchronized
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?
com.google.common.util.concurrent.RateLimiter#tryAcquire(int, long, java.util.concurrent.TimeUnit) also has the same question. For example, my maximum acquisition timeout is 5 seconds, but because there are 10,000 lock competitions If the mutex() resource is obtained after 10 seconds, isn't the timeout of the tryAcquire method useless?
Hi @cgdecker , is any one working on this issue? if not i want to work on this, please let me know
Hi @cgdecker , is any one working on this issue? if not i want to work on this, please let me know
Not yet @akhilambati