Custom ValueCache slower than custom CacheMap #274
Unanswered
KammererTob
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
We use Java Dataloaders in our Spring Boot project for GraphQL (still with the outdated/archived graphql-kickstart library).
In our current implementation we use a custom
CacheMapto cache values (wrapped in aCompletableFuture) between requests. Since this always was kind of a hacky way of doing a cross-request caching (this was beforeValueCachewas a thing) we wanted to switch over to use the defaultCacheMapand instead provide a customValueCache, which is a EhCache backed cross-request cache.After implementing this i noticed that our performance noticeable got worse (response time for large requests). It is even worse than completely disabling the cache (i.e. always returning a failed
CompletableFuturein thegetMethod of theValueCache), so that it always uses the BatchLoaders to load from the Database (locally in my tests).I am not entirely sure what causes this, or if this is expected, or if i am doing something wrong. Happy to help investigate this however i can.
Attached are two Timelines of my Profiling (always 5 large requests, after initially warming up the server/cache by executing the same request a few times before):
With caching completely disabled. Multi-threaded database lookup (i assume)

Cross-Request

ValueCachewith caching enabled:Beta Was this translation helpful? Give feedback.
All reactions