Comments (6)
I'm thinking of these two changes: https://github.com/Woutifier/ristretto/commits/wouter/clear-expiry
Since then, I've found another issue, which is that if you don't set a TTL at all (Just Set, not SetWithTTL), and the item you're setting is already in the cache, it will use the "Update" path. Update doesn't properly filter out items without expiration, and just creates a new "zero time" bucket and adds the item into that.
Edit: added a fix for the new issue to the branch above too.
from ristretto.
Hey @nemorales it seems we are encountering this as well. Did you run a garbage collection prior to running pprof? (I'm not 100% sure that it happens automatically).
Looking at the code there a chance for the expiration bucket cleanup to be skipped under load. There is a single goroutine responsible for a number of things, among which cleaning up the "just expired bucket". A timer ticker has a buffer of one, so if the cleanup is not happening fast enough (e.g. due to some type of lock contention, or a heavy OnEvict function), the ticker will skip. This can cause a bucket to not be cleaned up, and it will remain in place until the parent cache is GC'ed.
Unrelated (in terms of cause), but roughly in the same code: clearing the cache also doesn't currently clear the expiryMap, which seems to be an oversight. as it makes no sense to keep it around if the items themselves have been cleared.
Replication is fairly easy by just adding a time.Sleep of some duration (I used 1 millisecond) as the OnEvict function, which will cause the cleaning up of buckets to be too slow to keep up under any kind of load, triggering the behavior.
from ristretto.
@nemorales @Woutifier - Have you continued to experience this behavior? I'm seeing something similar and was curious if either of you found a solution.
from ristretto.
@Woutifier that's an interesting finding. Now I understand why ristretto has different memory usage behavior depending on the load: in my use case we decided not to use TTL but there are some cases in which memory usage grows without limit.
I'm taking a look at your commits, thanks for sharing what you learned!
from ristretto.
Related Issues (20)
- gopkg.in/yaml.v2 Denial of Service (DoS) HOT 1
- Is ristretto has callback function? HOT 1
- Is ristretto has callback function? HOT 1
- Sketch implementation does not seem to implement a count-min sketch HOT 1
- cleanupTicker leaked HOT 1
- Glog seems to be a bad idea HOT 1
- CM-Sketch: identical rows, maybe a mistake?
- [QUESTION]: Why is Ristretto at v0.1.1 when it is production ready?
- [BUG]: "mremap size mismatch" on arm 32bit HOT 1
- [QUESTION]: Is it possible to get experinece similar to redis MGET
- [QUESTION]: Differentiate between TTL and cost based eviction
- [FEATURE]: Support for Type Parameters, aka, generics HOT 5
- [BUG]: ristretto used about 2 x MaxCost memory?? HOT 5
- benchmark about gc or plan to reduce gc HOT 2
- [QUESTION]: Why did you choose ristretto as the project name ? HOT 2
- [FEATURE]: Loading or Compute If key is not present HOT 1
- How many bits tinyLFU uses to count access frequency? HOT 2
- [QUESTION]: Ristretto hit ratio benchmark result HOT 2
- [BUG]: <sync.Pool GC>
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ristretto.