wp-graphql / wp-graphql-smart-cache

Smart Caching & Cache Invalidation for WPGraphQL
61 stars 14 forks source link

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

Open WintersInstruments opened 3 months ago

WintersInstruments commented 3 months ago

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 commented 3 months ago

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:

WintersInstruments commented 3 months ago

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 commented 3 months ago

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

WintersInstruments commented 3 months ago

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 commented 3 months ago

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

WintersInstruments commented 3 months ago

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

josephfusco commented 3 months ago

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 commented 3 months ago

Hi Joe,

I disabled all the plugins one by one except for the GraphQL ones and there was no change in behaviour. The OPTIONS preflight is still taking an inordinate amount of time. On subsequent refreshes it seems the x-cache does register HIT:2,3,4 etc, but just never when the browser lands on the site for the first time.

[A red logo with white text Description automatically generated] @. Louis Tam Marketing Manager Winters Instruments 121 Railside Road, Toronto, ON M3A 1B2 Tel: 416-444-2345 ext. 6284 @*.**@*.***> www.winters.comhttp://www.winters.com/

2024 Platinum Standard Winner of Canada's Best Managed Companies

From: Joe Fusco @.> Sent: Wednesday, August 21, 2024 12:41 PM To: wp-graphql/wp-graphql-smart-cache @.> Cc: Louis Tam @.>; Mention @.> Subject: Re: [wp-graphql/wp-graphql-smart-cache] The plugin has stopped serving queries from disk cache on initial page load (Issue #290)

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.

- Reply to this email directly, view it on GitHubhttps://github.com/wp-graphql/wp-graphql-smart-cache/issues/290#issuecomment-2302525558, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BANQ2RE3OEO3B57HWD2QKNDZSS7J5AVCNFSM6AAAAABMUI5USWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBSGUZDKNJVHA. You are receiving this because you were mentioned.Message ID: @.**@.>>