dgraph-io / ristretto

A high performance memory-bound Go cache

Home Page:https://dgraph.io/blog/post/introducing-ristretto-high-perf-go-cache/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question - Keys added and Keys evicted graphs are similar??

varun06 opened this issue · comments

commented

Hey Folks,

I am testing Ristretto in QA environment. I am still trying to understand few things. Once thing that I noticed, line for Keys Added and Keys Evicted are super close to each other.

Screen Shot 2020-06-26 at 10 05 49 AM

I have a feeling that I am doing something wrong here.

Case size = 10gig

Hey @varun06, once the cache reaches the capacity (10 gigs) in this case, every new addition would try to make space for new insertions and so it would cause evictions.
Also, while inserting an item in the cache, you would set the cost param in the cache.Set call. Ensure that cost represents the correct cost of the item. If you set the cost of a single item as 10 GB, ristretto will evict all the old data when this key is inserted.

commented

Thanks a lot @jarifibrahim

That make sense. I am going to find out more about our median/99p response times this week. I am still not clear about cache falling all the way down to 0(I hope that's not a restart...). But is that also normal?

I am still not clear about cache falling all the way down to 0(I hope that's not a restart...)

@varun06 Do you mean you get 0 hits from ristretto?

commented

Apologies, I am definitely seeing the hits. Also there was a restart it seems that cleared the cache ofc.

At this point, I am trying to understand why our keys added stats is almost similar to keys evicted stats. Also added a stat to figure our the response size today.

@varun06 I could be wrong but I think the eviction would depend on your access pattern. if you're inserting data that never gets accessed and then new data is inserted, the old data will be evicted. Maybe look at the cache metrics (cache.Metrics) and see how your hits/misses are doing.

commented

Yeah, that's how our current pattern for cache hits is looking like -

Screen Shot 2020-06-29 at 11 34 56 AM

BTW, this is just test env, if everything goes well, we are planning to deploy to a significant scale.

This is how our get latency look after moving to ristretto -

Screen Shot 2020-06-29 at 11 38 43 AM

@varun06 Maybe a bigger cache is what you need.

commented

Yup, going to go to 50gig soon.

Github issues have been deprecated.
This issue has been moved to discuss. You can follow the conversation there and also subscribe to updates by changing your notification preferences.

drawing