Description
Is your feature request related to a problem? Please describe.
We have a large schema which is currently being cached in redis. Our schema cache is using significant resources due to its size (~64KB) and that it gets accessed multiple times per request (we process several hundred requests per second).
Our schema cache is putting an amount of pressure on redis (and even the raw networking) that really isn't sustainable.
Describe the solution you'd like
Being able to have the schema cache be managed in memory, but have the user/session cache in redis.
Describe alternatives you've considered
Using in-memory cache for everything:
We have tried this in the past but had issues with in-memory cache leaking memory. This was several versions ago. Maybe that has been fixed? Any drawbacks with in-memory cache other than memory usage?
Additional context
Overall the implementation of the schema cache, particularly the number of times it is accessed per request and it's potential size, does not seem well tailored for it being stored remotely.
Our schema does not often change w/o the backend getting redeployed anyway so we are not really concerned with schema invalidation.
Looked into how we would be able to use a different cache for schema and it seems like it would require forking and modifying DatabaseController
, SchemaCache
, and SchemaController
to be configured with a different CacheController
.
This seems like it would be useful for other users and well and we would be happy to commit it back into the project if there was interest.
Appreciate thoughts/advise on the specific problem we are facing and proposed solution.
Many thanks!
New Relic Graph showing time in redis is taking up 1/3 of all request time. Much more than even mongo.
Even with single schema cache enabled we still get thousands of redis operations per second. Most just reading the same ~64KB schema over and over.
A large amount of our network IO is from the schema cache being read from redis multiple times per request. It's enough bandwidth that it overwhelmed many of the redis configurations we tried.