rtCamp / nginx-helper

Nginx Helper for WordPress caching, permalinks & efficient file handling in multisite
https://wordpress.org/plugins/nginx-helper/
228 stars 121 forks source link

many http requests for /purge/tag/, slow response times #296

Open bozzmedia opened 1 year ago

bozzmedia commented 1 year ago

After logging our http requests I noticed many urls containing /purge/tag or /purge/author/ with 2-4 second response times. Our page edits are slow to save and wondering if this may be part of the issue.

Example:

https://redacted.org/purge/tag/roger-redacted/feed/rdf/
    200     0.8553  23 hours
https://redacted.org/purge/tag/roger-redacted/feed/atom/
    200     0.9721  23 hours
https://redacted.org/purge/tag/roger-redacted/feed/
    200     0.8625  23 hours
https://redacted.org/purge/tag/roger-redacted
    200     2.2739  23 hours

I am trying to interpret Could this indicate an issue with enabling the auto purge on post updates? Is that a typical response time? Appreciate any insights, thanks!

16gb apache VPS, PHP 8.0, redis object cache, nginx page cache

sashmarin commented 1 year ago

Seems similar to #257

I would suggest this fix. But the repository seems private, I can't commit. In my test case it speeds up Wordpress post saving from 9 seconds to 2 seconds.

--- a/admin/class-purger.php
+++ b/admin/class-purger.php
@@ -460,8 +460,12 @@ abstract class Purger {
                 * @param string $url URL to be purged.
                 */
                do_action( 'rt_nginx_helper_before_remote_purge_url', $url );
-
-               $response = wp_remote_get( $url );
+                
+                $request_args = array(
+                    'blocking' => false,
+                    'sslverify' => false
+                );
+               $response = wp_remote_get( $url, $request_args );