Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing a two level distributed cache #1819

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nilsflemstrom
Copy link

@nilsflemstrom nilsflemstrom commented Feb 3, 2022

To start I want to say that the default in-memory caching for a single instance works great. It is fast and can handle lots of load. My recommendation is to scale up instead of scale out if it’s possible.

But, I have been looking into the implementation of the distributed cache implementation. Currently it is mainly wrapping the default .NET distributed cache service IDistributedCache. When I tried to use an app service cluster in Azure I ran into some performance issues. Some pages with many blocks added to them didn’t behave well under load tests. After some debugging my conclusion is that the server talks a lot to the cache service. Works great for in-memory caching, but not so good when using a Redis cache or some other cache service that talks over the network.

So my suggestion is to create a simple two level distributed cache. The first level cache is an in-memory cache and the second level is the distributed cache. When something in the second level cache is changed the whole first level cache is invalidated and must be reloaded again.

I have tried to add functionality so that it doesn’t cause breaking changes for those who use the current distributed cache implementation.

@dnfadmin
Copy link

dnfadmin commented Feb 3, 2022

CLA assistant check
All CLA requirements met.

@tidyui
Copy link
Member

tidyui commented Feb 7, 2022

Just a thought. This PR doesn't contain any changes on common API's or components in the framework, it is a totally stand-alone cache implementation. Wouldn't it be interesting for you to release this as a stand-alone package on NuGet for Piranha? We would link to, and promote this on our modules repo and our homepage. https://github.com/PiranhaCMS/piranha.modules

Best regards

@nilsflemstrom
Copy link
Author

Yes. Yeah, ok. Let's do that instead. Makes more sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants