Skip to content
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

Apollo Server caching for Orion's graphql-server #280

Open
zeeshanakram3 opened this issue Dec 15, 2023 · 0 comments
Open

Apollo Server caching for Orion's graphql-server #280

zeeshanakram3 opened this issue Dec 15, 2023 · 0 comments

Comments

@zeeshanakram3
Copy link
Contributor

The idea is to add grphql-Server side caching for most used queries.

e.g. for each homepage load, we don't need to execute the DB query (since the result would not change much),
So the Idea is to identify such queries implement server-side caching with configurable TTL and Cache-Control settings

Caching Backend

The cached queries are stored as query<->response key/value pairs, either in-memory or some external caching backend (e.g. Redis). In-memory caching is easy to setup and use for starters.
However, If we want to horizontally scale the graphql-server by running multiple instance of it, then using a external caching backend is more performant efficient (to which all the running instance of graphql server can connect)

Changes required

We will need to make changes to

  • graphql schema to add suitable cache directives to entities
  • subsquid's graphql-server/openreader packages to configure server-side caching

Reference

https://www.apollographql.com/docs/apollo-server/performance/caching

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants