Support » Plugin: Page Speed Optimization » Bad directory structure logic for proxy scripts

  • Resolved aamir2007

    (@aamir2007)


    Hello,

    Its a good plugin with lot of efforts to improve wordpress speed however I recently run into an issue that may not be raised before. I run out of Inodes on my VPS server. Upon investigating I came to know that /uploads/abovethefold/proxy/* folder is consuming millions of inodes. That’s all due to the proxy cache is not properly managed and some unnecessary sub directories are created and then these are not cleared when we clear cache. Or atleast they should be cleared when we save plugin settings in proxy tab.

    Also another serious issue is that I see lot of entries in my php slow log regarding above the fold proxy trying to download scripts via curl. It is not properly handled may be you need to improve request headers and disable keep-alive header that may improve the curl performance.

    Would really appreciate if above issues are addressed ASAP.

    Regards,
    Aamir

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Optimalisatie.nl

    (@optimalisatie)

    Hi aamir2007,

    Thank you for reporting the problem and for your extensive information!

    There has been a report about the issue before ([@bluemad](https://wordpress.org/support/topic/above-the-fold-proxy-folder-size-increase/))

    The proxy cache is currently fairly simple and there is no cleanup. It currently depends on the website admin / developer to proxy specific scripts. The cache will then remain stable and small.

    The directory structure will keep the amount of files per directory under 2000 to prevent an inode problem. However, the amount of cache files should remain low and stable by preventing scripts with a changing url to be cached by the proxy.

    If you use auto capture to proxy any script and if the website contains a script with a changing url, e.g. a timestamp query string, a new cache entry will be created for each request. The configuration page shows a solution to capture such scripts by using a JSON config object.

    JSON Proxy Config Object
    JSON config objects enable advanced file based proxy configuration. JSON objects can be used together with simple file entry and must be placed on one line (no spaces are allowed).
    JSON config objects must contain a target url (the url that will be downloaded by the proxy). Regular expression enables to match a source URL in the HTML, e.g. an URL with a cache busting date string (?time) or an url on a different host. Valid parameters are url, regex, regex-flags, cdn and expire (expire time in seconds).
    Example:
    {"regex": "^https://app\\.analytics\\.com/file\\.js\\?\\d+$", "regex-flags":"i", "url": "https://app.analytics.com/file.js", "expire": "2592000"}

    The regex in the example will capture scripts with the url https://app.analytics.com/file.js?123456789 and create 1 cache entry.

    Regarding your suggestion for cURL request optimization, the plugin uses the WordPress method [wp_remote_get](https://codex.wordpress.org/Function_Reference/wp_remote_get) that automatically selects cURL or file_get_contents based on the server environment. We will investigate your tip to improve the performance by disabling keep-alive!

    Based on your feedback, the proxy cache structure will be improved including a clean up and a monitor to detect problems. It will be included in the next version.

    [ Signature moderated ]

    aamir2007

    (@aamir2007)

    Hello Jan,

    Thanks for the response. I will look into your suggestions.

    Plugin Author Optimalisatie.nl

    (@optimalisatie)

    Hi Aamir,

    Based on your feedback the proxy cache directory has been moved to /wp-content/cache/ and the wp_remote_get implementation has been improved by disabling keep-alive in v2.7.7.

    Thanks a lot for the suggestion!

    [ Signature moderated ]

    aamir2007

    (@aamir2007)

    Hello Jan,

    Thanks for such quick response. I am closely following all the updates and features in this plugin from long time and I like it too.
    I have experience with curl so I know turning off keep-alive header improves the curl performance for single file download.
    Here is my site. http://gilli.tv

    While looking for Critical CSS, I was having issues setting up your solution on my VPS, however I find Critical CSS Extractor chrome extension very helpful in this regard. It is very easy and quick way to generate critical css and produces ready to use css code. The only drawback I find is that I had to generate Criticla CSS for desktop and mobile screen separately and them mix them by adding css queries.

    Regards,
    Aamir Hussain
    Manager @ http://gilli.tv

    Plugin Author Optimalisatie.nl

    (@optimalisatie)

    Hi Aamir,

    Thanks again for your feedback and tips! We are developing a new automated solution to create professional quality critical CSS for unlimited pages. It will be included in a new plugin.

    I checked your website. You are just one step away from a Google PageSpeed 100 score. The remaining issue is Leverage browser caching (HTTP cache headers).

    W3 Total Cache includes a solution to automatically configure HTTP cache headers.
    [ Signature moderated ]

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    *Looks. Oh for goodness sake*

    Side note: @optimalisatie please do not put signatures in your replies. I’ve already replaced 20 or so of your replies with this.

    [ Signature moderated ]

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    Side side note: @optimalisatie I’ve just redacted your signature from over 100 of your replies. This was not fun.

    Please reply back to me that you understand and will refrain from signatures going forward.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Bad directory structure logic for proxy scripts’ is closed to new replies.