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

Adding Automatic persisted queries feature to Atlas/Orion #279

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

Adding Automatic persisted queries feature to Atlas/Orion #279

zeeshanakram3 opened this issue Dec 15, 2023 · 0 comments

Comments

@zeeshanakram3
Copy link
Contributor

This issue proposes adding Automatic persisted queries (APQs) feature to Atlas/Orion to improve network performance by sending smaller requests

Problem it addresses

In practice we've seen GraphQL query sizes ranging well above 10 KB just for the query text. This is significant overhead when compared with a simple URL of 50-100 characters.
Clients send queries to Apollo Server as HTTP requests that include the GraphQL string of the query to execute. Depending on your graph's schema, the size of a valid query string might be arbitrarily large. As query strings become larger, increased latency and network usage can noticeably degrade client performance.

For example GetChannelPaymentEvents query which is being used in the My Payments page is over 4KB in length, so by using APQs we could just reduce the request size to constant few hundred bytes.

How it works

A persisted query is a query string that's cached on the server side, along with its unique identifier (always its SHA-256 hash). Clients can send this identifier instead of the corresponding query string, thus reducing request sizes
To persist a query string, Apollo Server must first receive it from a requesting client. Consequently, each unique query string must be sent to Apollo Server at least once

Changes required

Orion

No changes are required in Orion's graphql server, as Apollo Server supports APQ without any additional configuration.

Atlas

Reference

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

@zeeshanakram3 zeeshanakram3 changed the title Adding Automatic persisted queries feature to Graphql Server Adding Automatic persisted queries feature to Atlas/Orion Dec 15, 2023
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