Looking for suggestion for intensive write (and evict) #721
-
Hi, but we have 10-20 millions or more keys, but in memory we can only hold a small portion of these keys(value is also very large, 1-10K) [doubt] really appreciate if can give any suggestion design or workaroud on this this is related to #719 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I'm not sure based on that description, so here are some random musings in case any of them strike home. To support concurrent writes, a dedicated buffer is used so that writers don't serialize against an eviction lock. This buffer is capped to In benchmarks the write and eviction rate is in the many millions of operations per second, which should be more than adequate for real usages. That is also reduced simply by the policy's higher hit rate, as fewer misses means fewer loads and evictions. The evicting thread is scheduled by the Other blocks can occur due to long running computations. That can be mitigated using If the cache entries are eligible for collection then you might need to tune your GC. It has been a while, but I think increasing the young gen to reduce premature oldgen promotions helps, as it allows the GC to sweep those entries up. That was true for older collectors like CMS if you are still on Java 8, but not often a problem on newer (regional) collectors like the Java 9+ default, G1. I hope some of that was helpful. Otherwise please provide some more details and we can try to figure it out. |
Beta Was this translation helpful? Give feedback.
I'm not sure based on that description, so here are some random musings in case any of them strike home.
To support concurrent writes, a dedicated buffer is used so that writers don't serialize against an eviction lock. This buffer is capped to
128 * ceilingPowerOfTwo(NCPU)
, e.g. 1024 for an 8 core system. If populated then the cache tries to aggressively flush it. If full then writers fallback to acquiring the eviction lock, which deschedules to the thread and allows the holder to be prioritized. The thread evicting performs a batch of work by flushing the read and write buffers under the lock. Since this is a small, bounded buffer it doesn't cause runaway growth and can absorb small bur…