Closed raghumirajkar closed 7 months ago
Hi @raghumirajkar and thanks for using FusionCache.
expected fusion cache to be more performant
FusionCache underneath uses IMemoryCache
for L1 and IDistributedCache
for L2, see the intro here:
It uses a memory cache (any impl of the standard
IMemoryCache
interface) as the primary backing store and, optionally, a distributed cache (any impl of the standardIDistributedCache
interface) as a secondary backing store for better resilience and higher performance, for example in a multi-node scenario or to avoid the typical effects of a cold start (initial empty cache, maybe after a restart).
Because of this it cannot physically be faster than MemoryCache
, since it is in fact MemoryCache
+ extra features.
One question you may pose yourself is "then why should I use FusionCache, instead of simply using MemoryCache?" and the answer to that are all the extra features of FusionCache like cache stampede prevention, an optional 2nd level, fail-safe, soft/hard timeouts, backplane, auto-recovery and many more.
Hope this helps, let me know.
PS: I'm experimenting with a new version that will use a more optimized memory cache for the L1 then MemoryCache, but there's nothing to see yet.
PPS: I'm also keeping an eye on this which may or may not come with .NET 9.
@jodydonetti Have you explored alternative like https://github.com/bitfaster/BitFaster.Caching for L1 cache instead of .NET MemoryCache ?
Hi @madhub , yep totally, on top of others. It's something I'm experimenting with from some time, playing with different designs, benchmarking them, etc.
One idea may be to have a new IFusionCacheMemoryLevel
or something like that so that we can switch between different implementations, like we already can with IDistributedCache
or IFusionCacheBackplane
.
Another idea is that I may also end up creating an optimized one specifically for FusionCache, and use that instead of depending on a 3rd party one.
Again, I'm playing with different designs and waiting to see what .NET 9 will bring to the table.
In the case of BitFaster.Caching for example there's the problem that the Duration
is per-cache and not per-cache-entry, see here.
I'm closing this: if you think I've missed something let me know and I'll gladly re-open it.
Describe the bug
Slow Performance observed in frequently used operations like Get/Set/Remove
To Reproduce
Here's a MRE (Minimal Reproducible Example) of the issue:
Expected behavior
Versions
I've encountered this issue on:
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context