[Performance] RedisRemoteEvictionExtension evicts just added key from all running instances
See original GitHub issueWhat does the bug do?
Even though the key was just added to cache the eviction is called on all currently running instances. Which makes startup performance really bad when a lot of new keys are added to cache. So when calling GetOrSetAsync even though key is not present in any layer of cache it still get’s evicted from memory layer from all other instances which makes a lot of overhead when adding new keys ( especially startup).
How can it be reproduced?
You can reproduce the bug by running this code…
var redisCacheLayer = new RedisCacheLayer(redisConnection);
var memoryCacheLayer = new MemoryCacheLayer();
var cacheStack = new CacheStack(new ICacheLayer[]
{
memoryCacheLayer,
redisCacheLayer
}, new ICacheExtension[]
{
new RedisRemoteEvictionExtension(redisConnection, new ICacheLayer[] {memoryCacheLayer})
});
cacheStack.GetOrSetAsync(); //even though it's first call for specific key it calls evict on all other instances.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Cache Tower
Distributed evictions, helping to keep caches across multiple application instances the same. All-async API, ready for high performance workloads.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I confirm that issue is fixed in version 0.11.0. Thank you.
Version 0.11.0 of Cache Tower is now released with the fix from #178 included - that should solve your problem. If you’re still encountering issues, let me know!