-
I'm using Caffiene to manage some reference data in a complicated spark job. It's working great up to a point... If I partition the data so that all the cores on a worker are being utilised (in my test case a single 48 core worker) then the removal of cache entries stops and i eventually run out of memory. However if I drop back the number of partitions so that 5 cores are always idle then everything works great. Is there a better way to do this? I've tried just leaving 1, 2, 3 or 4 cores idle but that doesn't seem to be enough and it seems a bit wasteful. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
The cache should induce backpressure on writes if eviction cannot keep up. Can you try running our stress test? By default the cache uses The async eviction isn't necessary for our own logic, but we do have callbacks (like |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply. I tried using |
Beta Was this translation helpful? Give feedback.
-
Unfortunately I'm stuck on java 8 for the time being. So it's version 2.9.3
of caffeine.
…On Tue, 18 Oct 2022 at 08:29, Ben Manes ***@***.***> wrote:
It might help to know which library and jdk version you are using, and
what the configuration and usages look like. For instance, v2 does not
deduplicate explicit refresh operations whereas v3 does (as shown in #694
<#694>). It might just be
that you should upgrade to the latest release.
—
Reply to this email directly, view it on GitHub
<#795 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAUOA57544KBLF46KFNTUITWDZGWTANCNFSM6AAAAAARHIDFOE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi. I managed to upgrade to java 11 and latest version of caffiene but still seeing the same problems. |
Beta Was this translation helpful? Give feedback.
The cache should induce backpressure on writes if eviction cannot keep up. Can you try running our stress test?
By default the cache uses
ForkJoinPool.commonPool()
for any async work, which includes evictions. There have been bugs in some JDKs where FJP could drop tasks (race conditions causing internal data loss) and we've gradually made Caffeine more robust to these cases. When the cache induces backpressure on writes due to too many pending evictions it should block writers on the eviction lock, thereby unscheduling those threads or assisting if the eviction wasn't actually run.The async eviction isn't necessary for our own logic, but we do have callbacks (like
Caffeine.evictionListener
…