dgraph icon indicating copy to clipboard operation
dgraph copied to clipboard

EvictAll vs LRUEvict

Open squalfof opened this issue 9 years ago • 3 comments

During analyzing, frequently EvictAll() case will be triggered as queries accumulating.

Assuming the most recent query result matters for users. It'll take time to EvictAll and some other rounds of queries to warm-up the cache, which in turn will impact the performance.

My question is, why there is not a LRUCache employed? It may reduce the chance of EvictAll() being triggered.

squalfof avatar Apr 22 '17 13:04 squalfof

Avoiding EvictAll would definitely improve 99% latency(Queries are stalled during stop the world). Can you please share some numbers indicating the performance impact. Currently we have same cache for pl's created due to both mutations and queries. So having an LRU cache would cause the pl's related to recent mutations to be retained in memory. I am not sure if LRUCache should be employed. There might be cases when a recent query accesses more data and causes eviction of pl's related to other queries which are run more frequently. But if same query is being sent to dgraph, i think the caching can be handled better at application layer.

Nevertheless We will definitely look at ways to minimise EvictAll() as much as possible.

janardhan1993 avatar Apr 22 '17 15:04 janardhan1993

We should be using an LRU cache, bound by certain memory size. Total eviction was a way around that I put in place long time ago.

manishrjain avatar Apr 22 '17 20:04 manishrjain

We switched it now, so that we no longer do EvictAll. We evict only a shard which affects much smaller proportion of queries.

manishrjain avatar Jun 30 '17 02:06 manishrjain