Join the community today
Become a Member

Wordpress Revisiting Wordpress Cache Enabler + Autoptimize Plugins For Page Load Speed Optimization

Discussion in 'Blogs & CMS usage' started by eva2000, Jun 25, 2018.

Thread Status:
Not open for further replies.
  1. eva2000

    eva2000 Administrator Staff Member

    37,354
    8,162
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,563
    Local Time:
    7:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Centmin Mod 123.09beta01 and higher can auto install Wordpress via centmin.sh menu option 22 and offers up one of 3 free caching methods out of the box for speeding up Wordpress installs. One of them is KeyCDN Cache Enabler which is the recommended option for ease of install, configuration and least problematic. Cache Enabler official documentation is here.

    cache-enabler-00.png

    centmin.sh menu option 22 selection menu
    Code (Text):
    --------------------------------------------------------
         Centmin Mod Menu 123.09beta01 centminmod.com     
    --------------------------------------------------------
    1).  Centmin Install
    2).  Add Nginx vhost domain
    3).  NSD setup domain name DNS
    4).  Nginx Upgrade / Downgrade
    5).  PHP Upgrade / Downgrade
    6).  XCache Re-install
    7).  APC Cache Re-install
    8).  XCache Install
    9).  APC Cache Install
    10). Memcached Server Re-install
    11). MariaDB MySQL Upgrade & Management
    12). Zend OpCache Install/Re-install
    13). Install/Reinstall Redis PHP Extension
    14). SELinux disable
    15). Install/Reinstall ImagicK PHP Extension
    16). Change SSHD Port Number
    17). Multi-thread compression: pigz,pbzip2,lbzip2...
    18). Suhosin PHP Extension install
    19). Install FFMPEG and FFMPEG PHP Extension
    20). NSD Install/Re-Install
    21). Update - Nginx + PHP-FPM + Siege
    22). Add Wordpress Nginx vhost + Cache Plugin
    23). Update Centmin Mod Code Base
    24). Exit
    --------------------------------------------------------
    Enter option [ 1 - 24 ] 22
    --------------------------------------------------------
    

    cache selection
    Code (Text):
    Default is to install KeyCDN WP Cache Enabler Plugin
    as it's more stable and reliable than WP Super Cache.
    Redis cache may have issues with caching due to long 6hr cache TTL
    You can select which caching method to use below:
    
    --------------------------------------------------------
            Wordpress Caching       
    --------------------------------------------------------
    1). KeyCDN Cache Enabler (default & recommended)
    2). Redis Nginx Level Caching (may have issues with some wp plugins)
    3). Wordpress Super Cache
    --------------------------------------------------------
    Enter option [ 1 - 3 ] 1
    


    Centmin Mod centmin.sh menu option 22 auto installes Wordpress with Cache Enabler's advanced cache configuration when selecting option 1 above so header responses for php would have X-Cache-Handler: wp meaning caching bypasses PHP (php-fpm) for best performance as opposed to seeing X-Cache-Handler: php which means cache goes through PHP which isn't optimal. If the X-Cache-Handler is missing, it also means advance caching is working.

    cache-enabler-advanced-header-01.png

    This can be optimally be combined with another free Wordpress plugin, Autoptimize which you can install via wp-admin add new plugins section. These 2 combined Wordpress plugins allow your Wordpress install to speed up dramatically.

    WP Admin -> Add Plugins search for autoptimize and install/active it

    autoptimize-00.png

    I am revisiting the option for Cache Enabler + Autoptimize as both have had updates since I latest wrote about them. Autoptimize now automatically detects if Cache Enabler is installed and prompts to disable minification for html and static files in Cache Enabler as Autoptimize can do that.

    Autoptimize WP Settings



    example for Autoptimize css and js cache entries
    Code (Text):
    ls -lah wp-content/cache/autoptimize/css
    total 220K
    drwxr-sr-x 2 nginx nginx 4.0K Jun 24 15:16 .
    drwxr-sr-x 4 nginx nginx 4.0K Jun 24 15:16 ..
    -rw-r--r-- 1 nginx nginx  66K Jun 24 15:16 autoptimize_44305560ceb4692067377f2b20c5b66b.css
    -rw-r--r-- 1 nginx nginx   25 Jun 24 15:16 autoptimize_4f8d03e3de118b7f4248a853a1217023.css
    -rw-r--r-- 1 nginx nginx  179 Jun 24 15:16 autoptimize_73db07958ed25a1ee2945e0a0d33df6e.css
    -rw-r--r-- 1 nginx nginx  62K Jun 24 15:16 autoptimize_c00786a379c0c2055d7eebde12735a3d.css
    -rw-r--r-- 1 nginx nginx  62K Jun 24 15:16 autoptimize_snippet_6ef01077b0e1d4157b7cc99acdbb0b05.css
    -rw-r--r-- 1 nginx nginx 4.0K Jun 24 15:16 autoptimize_snippet_e8a9268ac5336ef6ad3b9f3449fca917.css
    -rw-r--r-- 1 nginx nginx  189 Jun 24 14:13 index.html
    

    Code (Text):
    ls -lah wp-content/cache/autoptimize/js
    total 92K
    drwxr-sr-x 2 nginx nginx 4.0K Jun 24 15:16 .
    drwxr-sr-x 4 nginx nginx 4.0K Jun 24 15:16 ..
    -rw-r--r-- 1 nginx nginx  23K Jun 24 15:16 autoptimize_5b324a8352210869deec09cfc1338861.js
    -rw-r--r-- 1 nginx nginx  20K Jun 24 15:16 autoptimize_d04d810f2ab8313a719e916445926c39.js
    -rw-r--r-- 1 nginx nginx 4.8K Jun 24 15:16 autoptimize_snippet_0e6f10337d8f99922b98a9dddd7c85d7.js
    -rw-r--r-- 1 nginx nginx 2.6K Jun 24 15:16 autoptimize_snippet_4139854e7cec2bc66110f4d4879bd129.js
    -rw-r--r-- 1 nginx nginx 3.5K Jun 24 15:16 autoptimize_snippet_42e14db64bdda90ec2d5638849b1d529.js
    -rw-r--r-- 1 nginx nginx 1.4K Jun 24 15:16 autoptimize_snippet_5a03f97cc479b9f5d7efdaccec31bc17.js
    -rw-r--r-- 1 nginx nginx  426 Jun 24 15:16 autoptimize_snippet_647744ac714ddb4eef936ef732ff7d53.js
    -rw-r--r-- 1 nginx nginx 9.9K Jun 24 15:16 autoptimize_snippet_7121994eec5320fbe6586463bf9651c2.js
    -rw-r--r-- 1 nginx nginx  189 Jun 24 14:13 index.html
    


    detecting when Cache Enabler is installed

    autoptimize-01.png

    Other settings in advanced area

    autoptimize-02.png

    Extra settings you may want to enable i.e. remove wordpress emojis and remove wordpress query strings and loading 3rd party fonts asynchronously via webfont.js

    autoptimize-03b.png

    now if you use 3rd party Google fonts and selected combine and load asynchronously with webfont.js, then you would also want to add to preconnect field the following 3 entries too for
    Code (Text):
    https://ajax.googleapis.com, https://fonts.googleapis.com, https://fonts.gstatic.com


    autoptimize-03c.png

    3rd party affiliate/partner links

    autoptimize-04.png

    Cache Enabler WP Settings



    Leave cache minification disabled if you use Autoptimize. But definitely set a cache expiry time, clear cache on new post/comments and pre-compress cached pages.

    cache-enabler-02.png

    example from Cache Enabler cached entries
    Code (Text):
    ls -lahR wp-content/cache/cache-enabler/domain.com/
    wp-content/cache/cache-enabler/domain.com/:
    total 92K
    drwxrws--- 5 nginx nginx 4.0K Jun 24 15:27 .
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:17 ..
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 1
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 category
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 date
    -rw-rw---- 1 nginx nginx  49K Jun 24 15:17 index.html
    -rw-rw---- 1 nginx nginx  17K Jun 24 15:17 index.html.gz
    
    wp-content/cache/cache-enabler/domain.com/1:
    total 12K
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 .
    drwxrws--- 5 nginx nginx 4.0K Jun 24 15:27 ..
    drwxrws--- 2 nginx nginx 4.0K Jun 24 15:27 hello-world
    
    wp-content/cache/cache-enabler/domain.com/1/hello-world:
    total 84K
    drwxrws--- 2 nginx nginx 4.0K Jun 24 15:27 .
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 ..
    -rw-rw---- 1 nginx nginx  53K Jun 24 15:27 index.html
    -rw-rw---- 1 nginx nginx  18K Jun 24 15:27 index.html.gz
    
    wp-content/cache/cache-enabler/domain.com/category:
    total 12K
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 .
    drwxrws--- 5 nginx nginx 4.0K Jun 24 15:27 ..
    drwxrws--- 2 nginx nginx 4.0K Jun 24 15:27 uncategorized
    
    wp-content/cache/cache-enabler/domain.com/category/uncategorized:
    total 80K
    drwxrws--- 2 nginx nginx 4.0K Jun 24 15:27 .
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 ..
    -rw-rw---- 1 nginx nginx  49K Jun 24 15:27 index.html
    -rw-rw---- 1 nginx nginx  17K Jun 24 15:27 index.html.gz
    
    wp-content/cache/cache-enabler/domain.com/date:
    total 12K
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 .
    drwxrws--- 5 nginx nginx 4.0K Jun 24 15:27 ..
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 2018
    
    wp-content/cache/cache-enabler/domain.com/date/2018:
    total 12K
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 .
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 ..
    drwxrws--- 2 nginx nginx 4.0K Jun 24 15:27 06
    
    wp-content/cache/cache-enabler/domain.com/date/2018/06:
    total 80K
    drwxrws--- 2 nginx nginx 4.0K Jun 24 15:27 .
    drwxrws--- 3 nginx nginx 4.0K Jun 24 15:27 ..
    -rw-rw---- 1 nginx nginx  49K Jun 24 15:27 index.html
    -rw-rw---- 1 nginx nginx  17K Jun 24 15:27 index.html.gz
    


    Evaluating Page Load Speed



    I see alot of sites like to use Pingdom page speed testing tool but it's not that accurate at all. For one thing it emulates Chrome 39 browser which doesn't support HTTP/2 HTTPS !

    You should only use webpagetest.org and it's included Google Lighthouse tool for page speed testing. As it uses and allows you to test a variety of modern HTTP/2 HTTPS supported web browsers and mobile device browser and speed profiles. For full outline of using webpagetest.org check out How to use webpagetest.org for page load speed testing.

    Support


     
  2. eva2000

    eva2000 Administrator Staff Member

    37,354
    8,162
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,563
    Local Time:
    7:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x

    Other Recommended Wordpress plugins


    • Local Google Analytics Plugin which downloads Google Analytics script once a day and caches it locally.
    • Clearfy Plugin - by authors of Local Google Analytics plugin - extended options which overlap with Autoptimize and Cache Enabler but can be selectively enabled including native Local Google Analytics caching
    • You can also preload your cache via Warm Cache Wordpress Plugin which crawls your Wordpress sitemap. If you don't have a sitemap, check out Yoast SEO Wordpress plugin for generating the Wordpress sitemap which would be located at /sitemap_index.xml
    Yoast SEO sitemap

    yoast-seo-sitemap-01.png

    Warm Cache configuraton

    warm-cache-01.png

    Once Warm Cache sitemap url is configured you get some instructions for setting up a cronjob

    Warm Cache Cronjob Setup



    Warm Cache install instructions say to set cronjob to interval within your cache expiration setting i.e. 1hr expiry set 30 minute interval cronjob. So with my above set 6hr Cache Enabler expiry TTL = 6 hrs, I'd set it to run every 5 hrs for the url instructed to run via cronjob https://domain.com/?warm_cache=F3frwhOf4

    Setting up the cronjob via SSH as root user involves running crontab -e command to invoke nano linux text editor to add the cronjob that runs every 5 hrs
    Code (Text):
    11 */5 * * * curl -4s https://domain.com/?warm_cache=F3frwhOf4 >/dev/null 2>&1
    

    You can list cronjobs via crontab -l command, so output for
    Code:
    crontab -l
    
    would be for a typical Centmin Mod centmin.sh menu option 22 installed wordpress install
    Code (Text):
    crontab -l
    13 23 * * * /usr/local/src/centminmod/tools/autoprotect.sh >/dev/null 2>&1
    0 */4 * * * /usr/bin/cminfo_updater 2>/dev/null
    #*/15 * * * * sleep 662s ; wget -O - -q -t 1 http://domain.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    16 23 * * * echo "domain.com cacheenabler cron"; sleep 189s ; rm -rf /home/nginx/domains/domain.com/public/wp-content/cache/cache-enabler/* > /dev/null 2>&1
    0 */8 * * * sleep 298s ;/root/tools/wp_updater_domain.com.sh >/dev/null 2>&1
    17 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
    11 */5 * * * curl -4s https://domain.com/?warm_cache=F3frwhOf4 >/dev/null 2>&1
    


    and /var/log/cron log would have entries for it
    Code:
    tail -20 /var/log/cron
    You can also manually run the cronjob url link in SSH type
    Code (Text):
    curl -4s https://domain.com/?warm_cache=F3frwhOf4
    

    example output seems to be html based
    Code (Text):
    curl -4s https://domain.com/?warm_cache=F3frwhOf4
    
    Start at item 0 20<br/>Start with submap: https://domain.com/post-sitemap.xml<br/>Busy with: https://domain.com/<br/>Busy with: https://domain.com/1/hello-world/<br/>Start with submap: https://domain.com/page-sitemap.xml<br/>Busy with: https://domain.com/<br/>Busy with: https://domain.com/<br/>Busy with: https://domain.com/sample-page/<br/>Start with submap: https://domain.com/category-sitemap.xml<br/>Busy with: https://domain.com/category/uncategorized/<br/>Busy with: https://domain.com/category/uncategorized/<br/>Updating to start (next time) at : 20<br/><br/>Crawled 7 pages in 1.5697419643402 seconds.<br><br><strong>Done!</strong>
    


    Checking Warm Cache settings listing for that manual warm cache sitemap index crawl run

    warm-cache-02.png

    Warm Cache FAQ



    How to disable logging completely (for very large sites)?

    Set a define in your wp-config (at the top, newline, after <?php ) with name MP_WARM_CACHE_NO_LOGGING_AT_ALL and value “yes”
    Example
    Code (Text):
    define(‘MP_WARM_CACHE_NO_LOGGING_AT_ALL’, ‘yes’);
    


    How to override the 20 pages crawl limit

    Set a define in your wp-config (at the top, newline, after <?php ) with name MP_WARM_CACHE_FILTER_LIMIT and value INTEGER

    Example
    Code (Text):
    define(‘MP_WARM_CACHE_FILTER_LIMIT’, 25);
    
     
  3. eva2000

    eva2000 Administrator Staff Member

    37,354
    8,162
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,563
    Local Time:
    7:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  4. eva2000

    eva2000 Administrator Staff Member

    37,354
    8,162
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,563
    Local Time:
    7:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Looks like Autoptimize 2.4 is coming soon Topic: Autoptimize 2.4 coming soon, need your help to test! | WordPress.org

    Trying the 2.4 beta out = 2.3.99 where you can choose not to aggregate optimised css/js files

    autoptimize-24-01.png autoptimize-24-02.png
     
  5. eva2000

    eva2000 Administrator Staff Member

    37,354
    8,162
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,563
    Local Time:
    7:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  6. eva2000

    eva2000 Administrator Staff Member

    37,354
    8,162
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,563
    Local Time:
    7:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x

    Webpagetest.org Cache Enabler vs Redis Nginx Caching Wordpress Installs



    Centmin Mod 123.09beta01 also offers Redis Nginx level caching for Wordpress auto installs and I decided to check out Webpagetest.org pagespeed for Wordpress full page caching via Cacher Enabler vs Redis Nginx level caching. I tested both default Wordpress TwentySeventeen and OceanWP theme all with the above outlined additional Wordpress plugins for, Autoptimize, Warm Cache, and Clearfy.

    Test was done on my HostUS.us 2GB OpenVZ VPS in Los Angeles against Webpagetest.org San Francisco Cable 5mbps speed profile. Each test was run over 3 times for the median.

    Order of results are:
    • Wordpress Cache Enabler full page cache - OceanWP Theme
    • Wordpress Redis Nginx full page cache - OceanWP Theme
    • Wordpress Redis Nginx full page cache - TwentySeventeen
    • Wordpress Cache Enabler full page cache - TwentySeventeen
    Filmstrip 60FPS view shows Cache Enabler is slightly faster for both themes for SpeedIndex - perceived visual rendering for OceanWP theme and very close for default TwentySeventeen theme

    wpt-wordpress-cacher-enabler-vs-redis-nginx-caching-01.png

    wpt-wordpress-cacher-enabler-vs-redis-nginx-caching-02.png
    wpt-wordpress-cacher-enabler-vs-redis-nginx-caching-03.png
    wpt-wordpress-cacher-enabler-vs-redis-nginx-caching-04.png

    Individual Webpagetest.org test summaries

    Wordpress Cache Enabler full page cache - OceanWP Theme

    wpt-wordpress-cacher-enabler-vs-redis-nginx-caching--ce-oceanwp-01.png

    Wordpress Redis Nginx full page cache - OceanWP Theme

    wpt-wordpress-cacher-enabler-vs-redis-nginx-caching--redis-oceanwp-01.png

    Wordpress Redis Nginx full page cache - TwentySeventeen

    wpt-wordpress-cacher-enabler-vs-redis-nginx-caching--ce-twentyseventeen-01.png

    Wordpress Cache Enabler full page cache - TwentySeventeen

    wpt-wordpress-cacher-enabler-vs-redis-nginx-caching--redis-twentyseventeen-01.png

    Google Lighthouse 3G Page Speed Results



    Webpagetest.org has optional option to enable Google Lighthouse pagespeed testing on a 3G mobile metrics as well using runtime environment as follows. Looks like if you enable it in Cable 5mbps profile, the emulation for 3G is disabled !

    lighthouse-runtime.png

    Google Lighthouse Results
    • Here the results differ slightly for OceanWP theme, FMP - First Meaningful Paint has Redis Nginx caching leading slightly at 580ms vs Cache Enabler's 610ms and also leading for Perceptual Speed Index at 591ms vs 618ms
    • For TwentySeventeen theme, Cache Enabler has slight lead for First Meaningful Paint at 560ms vs Redis Nginx caching at 580ms and Perceptual Speed Index leading at 715ms vs 745ms

    Wordpress Cache Enabler full page cache - OceanWP Theme

    lighthouse-wordpress-cacher-enabler-vs-redis-nginx-caching--ce-oceanwp-01.png

    Wordpress Redis Nginx full page cache - OceanWP Theme

    lighthouse-wordpress-cacher-enabler-vs-redis-nginx-caching--redis-oceanwp-01.png

    Wordpress Redis Nginx full page cache - TwentySeventeen

    lighthouse-wordpress-cacher-enabler-vs-redis-nginx-caching--redis-twentyseventeen-01.png

    Wordpress Cache Enabler full page cache - TwentySeventeen

    lighthouse-wordpress-cacher-enabler-vs-redis-nginx-caching--ce-twentyseventeen-01.png
     
    • Like Like x 1
  7. eva2000

    eva2000 Administrator Staff Member

    37,354
    8,162
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,563
    Local Time:
    7:42 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    • Like Like x 1
..
Thread Status:
Not open for further replies.