Skip to content

GraphQL WordPress Plugin Performance Issue #1873

@gagan0123

Description

@gagan0123

GraphQL Plugin's performance deteriorates significantly with the number of post-types and taxonomies defined in the WordPress.

Reproduce the bug:

  1. Try to add more than 20-30 post types, with around the same number of taxonomies defined for them.
  2. Check out the response timing of GraphQL endpoint.

To further add to this issue, even caching does not resolve this performance problem. I've tried with

  1. Object Caching (Redis)
  2. MySQL caching(I know I shouldn't have)
  3. Using a GraphQL caching plugin for WordPress

Screencast for the same:

Query statistics:

Request Type: WordPress Homepage GraphQL Request(just endpoint) WP-JSON Request(just endpoint) GraphQL Request(Single Post) WP-JSON Request(Single Post)
Timing with default WordPress 85 ms 220 ms 80 ms 230 ms 80 ms
Timinig with 10 post types and 10 taxonomies 90 ms 400 ms 110 ms 407 ms 100 ms
Timing with 50 post types and 50 taxonomies 160 ms 1650 ms 260 ms 1650 ms 230 ms

Here's a link to XDebug profiling for the above requests(I've skipped the 10 post type in there)
https://drive.google.com/drive/folders/1-U_8Gb4BsL_UEHMyO0NKthRRkXQmq_2i?usp=sharing

Related info:

What version of WPGraphQL you're using, and the platform(s) you're running it on

WPGraphQL version: 1.3.5

What other plugins you're using

No plugin active on the site except WPGraphQL

The behavior you expect to see, and the actual behavior

The number of post types and taxonomies defined in a WordPress site should have minimal/no impact on the performance of GraphQL queries.

Any website running WooCommerce, has multiple post types defined for things like:

  1. Orders
  2. Products
  3. Variations
  4. Coupons

having custom taxonomies like:

  1. Product type
  2. Product visibility
  3. Product categories
  4. Product tags
  5. Product shipping classes
  6. Product Color
  7. Product Design
  8. Product Material
  9. Product Size
  10. Product Style

Once you set this up, and add a few more plugins that adds CPTs and site almost becomes unusable, if built using GraphQL.

When reporting a bug, please be sure to include the following:

  • A descriptive title
  • An isolated way to reproduce the behavior (example: GitHub repository with code isolated to the issue that anyone can clone to observe the problem)
  • What version of WPGraphQL you're using, and the platform(s) you're running it on
  • What other plugins you're using
  • The behavior you expect to see, and the actual behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions