EvictAll vs LRUEvict
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.
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.
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.
We switched it now, so that we no longer do EvictAll. We evict only a shard which affects much smaller proportion of queries.