Fixes experimental_approximateDocumentStoreMiB #5629
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The ApolloServer documentation calls out a setting for
experimental_approximateDocumentStoreMiB
allowing you to set max size of the internal documentStore.Current code for
initializeDocumentStore
:That code relies on
this.experimental_approximateDocumentStoreMiB
, but that variable is never set in the constructor. This PR fixes that.That being said, I would actually like to go one step further, to allow passing a custom
documentStore
as part of the constructor. One of our graphql server processes maintains 20 differentApolloServer
that host different versions of schema-stitched APIs (cms-v1, cms-v2, cms-v3, dms-v1 etc). It would be nice if I could re-use the document store between all of those instances since there is considerable overlap in the queries between the different versions of the graphql servers. Right now it gobbles up memory because we end up with 30mb x 20 servers. I didn't want to do that step, because that's really more of a feature request, but I'd be willing to update this PR, or spin a new one to include that functionality if it's acceptable.