The class responsible for accepting new cache operations which will be handled asynchronously is CacheActionDispatcher. In case of a high load, when the queue is full (=1024 entries), the add() method removes the oldest 256 entries. However, we can't afford losing the updates (as it may result in having stale entries in the cache), so all the removed entries are compacted into one big invalidate action.
The compaction action (CacheActionDispatcher#cleanTheQueue) still holds the lock taken in add() method, so threads which tries to add something to the queue have to wait until cleanTheQueue() ends.
Maybe we can optimise the CacheActionDispatcher#add->cleanTheQueue part, so it won't hold the lock for the whole time.