Client Side Caching with Otter
rueian opened this issue · comments
Otter is a high performance lockless cache which uses proactive ttl and s3-fifo eviction policies.
Lockless is an important property that redis server-assisted client-side caching needs because the invalidation messages from redis should be applied as fast as possible. Applying invalidation messages should be the first priority if possible.
But in the current implementation, the pipelining goroutine handing invalidation messages competes with other reader goroutines to acquire the LRU lock. This will delay the invalidations and further block the pipeline. Using otter can solve this.
@rueian provide an option to use https://github.com/phuslu/lru?
otter is slow on set but fast on get, phuslu lru is more balanced and uses lesser mem
meaning for cache write intensive workload, better to use phuslu, for read intensive, better to use otter
@ouvaa Do you have insights on why phuslu is better at write?