-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
framework/config,server: configkey caching #9628
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9628 +/- ##
==========================================
Coverage 15.57% 15.58%
- Complexity 12049 12054 +5
==========================================
Files 5505 5506 +1
Lines 482635 482694 +59
Branches 61701 60954 -747
==========================================
+ Hits 75187 75211 +24
- Misses 399141 399176 +35
Partials 8307 8307
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - real world tests may be necessary, or a smoketests on test matrix.
Added caching for ConfigKey value retrievals based on the Caffeine in-memory caching library. https://github.com/ben-manes/caffeine Currently, expire time for a cache is 30s and each update of the config key invalidates the cache. On any update or reset of the configuration, cache automatically invalidates for it. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
16530f1
to
a890b6a
Compare
@blueorangutan package |
@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10930 |
@blueorangutan test |
@shwstppr a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian test result (tid-11317)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good improvement !
framework/config/src/main/java/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
Show resolved
Hide resolved
framework/config/src/main/java/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM. Just a couple of queries.
|
||
private HashMap<String, Pair<String, ConfigKey<?>>> _allKeys = new HashMap<String, Pair<String, ConfigKey<?>>>(1007); | ||
|
||
HashMap<ConfigKey.Scope, Set<ConfigKey<?>>> _scopeLevelConfigsMap = new HashMap<ConfigKey.Scope, Set<ConfigKey<?>>>(); | ||
|
||
public ConfigDepotImpl() { | ||
configCache = Caffeine.newBuilder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor - in the next iteration, could we move/refactor caching library object creation & configuration to a separate class/utility/framework; so users only need to import & call the method to get the Cache objects/entities, but configuration etc are in that utility - making it easier to change the caching library in future. Otherwise LGTM, thanks @shwstppr
Follow up for apache#9628 Creates a utility class LazyCache which currently wraps Caffeine library Cache class. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Follow up from apache#9628 (comment) Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Follow up from apache#9628 (comment) Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Added caching for ConfigKey value retrievals based on the Caffeine in-memory caching library. https://github.com/ben-manes/caffeine Currently, expire time for a cache is 30s and each update of the config key invalidates the cache. On any update or reset of the configuration, cache automatically invalidates for it. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Follow up for apache#9628 Creates a utility class LazyCache which currently wraps Caffeine library Cache class. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Description
Added caching for ConfigKey value retrievals based on the Caffeine in-memory caching library.
https://github.com/ben-manes/caffeine
Currently, expire time for a cache is 30s and each update of the config key invalidates the cache. On any update or reset of the configuration, the cache automatically invalidates for it.
This useful when there are concurrent operations as it will prevent multiple DB queries within a short span of time.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?