Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Cache grows when not using enableSingleSchemaCache #4247
It has been observer that the new caching mechanism (LRUCache) would not prune proactively it's cache after a certain amount of time, leading to memory growth and explosion.
Steps to reproduce
Memory usage should somewhat remain constant, unused data should not be kept indefinitely.
See discussion over: #4235
1- make singleSChemaCache default (this should be pretty harmless)
This was referenced
Oct 11, 2017
Yeah we need to address this. I took a look at some of the code at one point. Haven't confirmed it but it does just seem to be a bad case of not cleaning up the multitude of schema caches that accumulate over time. Interesting code being here in SchemaCache.js. Over time with random prefix ids I imagine you could fill up memory no sweat. One way would be to track formerly used caches (particularly stale?) and flush those after a certain count. Maybe a cache of existing cache prefixes that still exist so we can keep track of them?
The issue is that:
We could manually prune the cache just after each requests or periodically, and/or when the request is over; remove the key associated in the cache with it.
referenced this issue
Dec 21, 2017
The _Schema query has been in our slow queries tab on mLab for a while. Will setting this affect the number of _Schema queries, or only the memory due to caching the results?
Edit - I found this in Definitions.js
So it should also reduce the number of queries run.