FEATURE: Tenant partitioned caches could improve cache-hit ratio#2956
Closed
rPraml wants to merge 1 commit into
Closed
FEATURE: Tenant partitioned caches could improve cache-hit ratio#2956rPraml wants to merge 1 commit into
rPraml wants to merge 1 commit into
Conversation
rPraml
added a commit
to FOCONIS/ebean
that referenced
this pull request
Aug 10, 2023
…cache-hit ratio
d34f73f to
21b0070
Compare
Member
|
Updated into and replaced by #3809 |
rbygrave
added a commit
that referenced
this pull request
Jul 1, 2026
* Add tenant-partitioned L2 caches (#2956) When `tenantPartitionedCache` is enabled, each tenant gets its own cache namespace (keys include the tenant id), improving cache-hit ratio by preventing cross-tenant key collisions. Refactor BeanDescriptorCacheHelp to abstract base class with two concrete subclasses: - BeanDescriptorCacheHelpFixed - static cache refs (original behaviour) - BeanDescriptorCacheHelpPartitioned - per-request Supplier<> lookup so the correct tenant-scoped cache is resolved on each access Fix background-thread invalidation: clear(name) in partitioned mode now scans all matching cache entries by key prefix rather than calling tenantProvider.currentId() which is null/wrong on background executor threads. Add SpiCacheManager.clearTenant(tenantId) to allow removal of all cache entries for a deactivated tenant, preventing unbounded memory growth in long-running multi-tenant deployments. Also load cache settings (cacheMaxSize, cacheMaxIdleTime, etc.) from application properties - these were previously missing from loadSettings(). * Fix versions in test-java16 --------- Co-authored-by: robin.bygrave <robin.bygrave@eroad.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello @rbygrave,
this is more or less a proof-of-concept, where I need your feedback
we have a multi-tenant application with ~ 50 tenants. I noticed, that we get a lot of 'cache clears' from other customers.
We cache a lot of things in our applications (user-directory, settings, ...) and if one customer updates the settings e.g. it will invalidate the caches for all other. So I tried to experimet with tenant partitioned caches, which means, each tenant has its own set of caches.
On the other hand, caches had to be created dynamically and would - at least in current implementation - stay there forever, also if the tenant does not longer exist.
I don't have exact numbers about this improvement, but do you think, this could be useful?