-
Notifications
You must be signed in to change notification settings - Fork 271
Integrate class cache #3270
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
base: integration
Are you sure you want to change the base?
Integrate class cache #3270
Conversation
apmoriarty
commented
Nov 10, 2025
- TypeFactory now uses a CaffeineCache
- Document, Attributes, Content use a ThreadLocal Caffeine cache found in the Attribute class
- Updated DocumentSerializationIT for better coverage
…of the ClassCache TypeFactory now uses a CaffeineCache
warehouse/query-core/src/main/java/datawave/query/attributes/Content.java
Outdated
Show resolved
Hide resolved
warehouse/query-core/src/main/java/datawave/query/attributes/Content.java
Outdated
Show resolved
Hide resolved
| protected long sizeInBytes = Long.MIN_VALUE; | ||
|
|
||
| // used by Document, Attributes and TypeAttribute | ||
| protected static final ThreadLocal<ClassCache> classCache = ThreadLocal.withInitial(CaffeineClassCache::new); |
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.
Just curious why its thread local. Off the top of my head it sounds like it'd be better to share across all threads since we're still gonna end up doing reflection on each thread. Is it to remove contention?
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.
Correct. Even though the Caffeine cache won out on performance there was still a lot of contention in an environment with lots of threads. Making this ThreadLocal improved the time to parse each document and reduced the overall wall clock time.