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

The plugin has stopped serving queries from disk cache on initial page load #290

Open
WintersInstruments opened this issue Aug 16, 2024 · 8 comments
Labels
needs: reproduction This issue needs to be reproduced independently

Comments

@WintersInstruments
Copy link

Hi there, an issue arose just now where my graphQL queries are not being served form cache on the server side anymore the first time the page is loaded. If I reload the page then the query loads.

I've purged my cache and done this repeatedly to the same queries but the problem persists.
It was consistently serving from cache just yesterday

@josephfusco
Copy link
Member

Hey @WintersInstruments can you please clarify the behavior that you expect? You've stated that you've purged your cache repeatedly and that the query is not being served from cached, however this feels like expected behavior.

If you can please provide more information on what your expectations are, and the steps for us to try and reproduce, we can try to help you better.


Things to consider with cache:

  • If the request is authenticated, it will bypass cache (i.e. logged into WordPress in one tab and testing your GraphQL query in another tab)

  • The cache key for a query is made up of both the query AND the variables.
    For example, the combination of the following query and variables will be cached uniquely:

    { "id": 1 }
    { "id": 2 }
    query GetPostById($ID: ID!) {
      post(id: $ID) {
        id
        title
      }
    }
  • Manually purging cache will lead to more cache misses

@josephfusco josephfusco added the needs: author response Pending information from the author label Aug 19, 2024
@WintersInstruments
Copy link
Author

Hi there, I took another look at the problem and it appears the issue is actually the OPTIONS preflight is taking way too long.

Header set Access-Control-Allow-Origin: //url here Header set Access-Control-Allow-Methods "GET, OPTIONS" Header set Access-Control-Allow-Headers "Content-Type, Authorization" Header set Access-Control-Max-Age "86400"

On initial load this continues to be extremely slow.

@josephfusco
Copy link
Member

Hey @WintersInstruments, can you please share what version of WPGraphQL Smart Cache & WPGraphQL (and any other possibly relevant plugins) you are using?

@WintersInstruments
Copy link
Author

Hi @josephfusco

I'm using WPGraphQL 1.28 and WPGraphQL Smart Cache 1.3.2

Also WpGraphQL for ACF
WP .htaccess editor
Post Types Order
Image optimization by optimole
Headless mode
Firebird Lite
Category Order and Taxonomy Terms Order
ACF
ACF Photo Gallery Field

@josephfusco
Copy link
Member

Thanks for the info! If you use Postman or a similar standalone client, are you still experiencing the slowness with the options preflight?

@WintersInstruments
Copy link
Author

Hi Joe, when I run the query in postman with an OPTIONS method it's coming back at 614ms
image

@josephfusco
Copy link
Member

Have you noticed any performance improvements after deactivating other plugins? I would love for us to get this narrowed down to a specific plugin if possible.

@WintersInstruments
Copy link
Author

WintersInstruments commented Aug 21, 2024 via email

@josephfusco josephfusco added needs: reproduction This issue needs to be reproduced independently and removed needs: author response Pending information from the author labels Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: reproduction This issue needs to be reproduced independently
Projects
None yet
Development

No branches or pull requests

2 participants