Ristretto v2.4.2 #9773
matthewmcneely
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Ristretto v2.4.2 is out — and please skip v2.4.1
v2.4.2is released. It's a one-line fix, but an important one: it reverts a change fromv2.4.1that caused a sizable memory regression for some caches. If you're onv2.4.1, I'd upgrade tov2.4.2straight away — and if you're onv2.4.0or earlier, you can jump tov2.4.2and skipv2.4.1entirely.What happened
v2.4.1shipped #482, which pre-allocated thesampledLFUkeyCostsmap toNumCounters/10at construction, on the assumption of the recommended 10:1 counter-to-item ratio. The intent was to avoid map resizing under load.The catch is that
keyCoststracks admitted items, which are bounded byMaxCostand your cost distribution — not by the counter count. So for a cache with a largeNumCountersand a working set that never gets nearNumCounters/10, this committed a big block of empty map buckets at boot and held it flat, andclear()re-inflated to the same size instead of releasing. It reads as a flat RSS bump at startup rather than a leak, which is what made it easy to miss.The size scales with
NumCounters, so the impact depends on your config. On one Dgraph build withNumCounters ≈ 2^28, the pre-allocated map alone accounted for roughly half a GB of resident memory that lazy growth would never have touched. Smaller counter counts see proportionally less.The fix
v2.4.2reverts #482 — back to lazy map growth and aclear()that actually frees. No API changes, no config changes, nothing else in this release. Drop-in upgrade.What's next
Eager sizing is still a reasonable optimization when your working set really is close to
NumCounters/10— it was just wrong as a default keyed off the wrong quantity. I'd like to bring it back as an opt-inConfighint you can set when it fits your workload, rather than something that fires for everyone. Tracking that in #493, and happy to hear how folks would want to configure it.Thanks, and apologies to anyone who got bitten by the
v2.4.1footprint.All reactions