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

Slow GraphQL queries on larger schemas #8035

Closed
andrewfairlie opened this issue Jun 9, 2021 · 1 comment
Closed

Slow GraphQL queries on larger schemas #8035

andrewfairlie opened this issue Jun 9, 2021 · 1 comment
Labels

Comments

@andrewfairlie
Copy link

andrewfairlie commented Jun 9, 2021

Description

When a schema has multiple sections and entry types, every query seems to be a lot slower. For example

{
    ping
}

On an empty public schema takes 48ms. Once that schema has access to sections and entry-types, the exact same query shoots up to 203ms. Even when GraphQL caching is enabled, the difference persists. Fewer sections = faster queries, even if those sections have nothing to do with the query at hand.

It feels like something to do with parsing or generating the schema is happening on the fly in each query. I might be mistaken. We see the increase in execution time creep up with each new section added.

Steps to reproduce

  1. Run a ping test on an empty schema
  2. Run a ping test on a schema attached to a bunch of sections

Additional info

  • Craft version: Craft CMS 3.6.16
  • PHP version: 8.07
  • Database driver & version: MySQL 5.7.0
  • Plugins & versions: I've disabled all plugins for the purpose of this experiment
@andris-sevcenko
Copy link
Contributor

The GraphQL schema needs to be generated for every query (no matter how simple) so that the query can be validated, which incurs overhead, that increases as the site's complexity increases.

There's a whole discussion about this over at #7222, so I'm closing this as a duplicate.

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

No branches or pull requests

2 participants