Want more timely Centmin Mod News Updates?
Become a Member

Nginx PageSpeed Benefits of ngx_pagespeed

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by eva2000, Aug 7, 2014.

  1. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Thought I'd start documenting specific examples where you can benefit from using ngx_pagespeed. While not all web sites, web apps and web designs will have such benefits, you'd have to decide yourself :) Latest Centmin Mod 123.09beta01 also supports installing ngx_pagespeed as a dynamic Nginx module.


    For this forum, a huge benefit for ngx_pagespeed which Centmin Mod Nginx installs and supports (but disabled by default) is for on the fly image optimisations to optimise images for both desktop and mobile and tablet users (yes you can have different levels of optimisations for both types). You can see this forum's pagespeed.conf config file settings at Nginx PageSpeed - This forum's pagespeed.conf | Centmin Mod Community

    Some stuff you just can't manually optimise for - auto user uploaded image attachment optimisation and conversion to webp format via ngx_pagespeed

    auto optimised PNG conversion where browser doesn't support WebP
    auto optimised conversion of user attachments from PNG to WebP format where browser supports WebP. Almost 88KB size reduction for those 3 images combined by converting on the fly to WebP format. Now imagine 100s of images on your site and with average web page sizes blowing out to nearly 2MB and 80% being related to image size, you can see how ngx_pagespeed can help :)
    excerpt from ngx_pagespeed stats ~52% reduction in image sizes served to visitors

    Code:
    image_rewrite_total_bytes_saved:                              243473
    image_rewrite_total_original_bytes:                           468526

    Code:
    image_file_count_reduction:                                        0
    image_rewrites:                                                   14
    image_resized_using_rendered_dimensions:                           0
    image_norewrites_high_resolution:                                  0
    image_rewrites_dropped_intentionally:                              7
    image_rewrites_dropped_decode_failure:                             0
    image_rewrites_dropped_mime_type_unknown:                          0
    image_rewrites_dropped_server_write_fail:                          0
    image_rewrites_dropped_nosaving_resize:                            0
    image_rewrites_dropped_nosaving_noresize:                          7
    image_rewrites_dropped_due_to_load:                                0
    image_rewrites_squashing_for_mobile_screen:                        0
    image_rewrite_total_bytes_saved:                              243473
    image_rewrite_total_original_bytes:                           468526
    image_rewrite_uses:                                             1958
    image_inline:                                                   1142
    image_webp_rewrites:                                               7
    image_rewrite_latency_total_ms:                                 6619
    image_ongoing_rewrites:                                            0
    image_webp_conversion_gif_timeouts:                                0
    image_webp_conversion_png_timeouts:                                0
    image_webp_conversion_jpeg_timeouts:                               0
    image_webp_alpha_timeouts:                                         0
    image_webp_opaque_timeouts:                                        0
    in_place_oversized_opt_stream:                                     0
    in_place_uncacheable_rewrites:                                     0
    If you're using Centmin Mod Nginx with ngx_pagespeed enabled, you can enable pagespeed statistics following the instructions at ngx_pagespeed install on Centmin Mod - Menu based Nginx installer for CentOS servers

    Or if you're more comfortable in SSH command line to run would be (provided you have enabled ngx_pagespeed)
    Code:
    curl -s localhost/ngx_pagespeed_statistics
    For ngx_pagespeed message log it's in memory only so no file to view. You'd run SSH commands would be
    Code:
    curl -s localhost/pagespeed_global_admin/message_history
    
    or
    Code:
    curl -s localhost/ngx_pagespeed_message
    
    Provided you have properly enabled Pagespeed console as outlined at ngx_pagespeed install on Centmin Mod - Menu based Nginx installer for CentOS servers and enabled MessageBufferSize
    Code:
    #######################################################
    # Set it to 0 if you want to disable this feature.
    # pagespeed MessageBufferSize 100000;
    
    enabled
    Code:
    #######################################################
    # Set it to 0 if you want to disable this feature.
    pagespeed MessageBufferSize 100000;
    
    restart Nginx web server for it to take effect

    As per Nginx Pagespeed Troubleshooting guide at Nginx PageSpeed - Nginx Pagespeed Troubleshooting steps | Centmin Mod Community if you see no permission messages that is normal for 3rd party urls (not your own site hosted).
     
    Last edited: Mar 4, 2017
  2. rdan

    rdan Well-Known Member

    5,439
    1,399
    113
    May 25, 2014
    Ratings:
    +2,188
    Local Time:
    3:11 PM
    Mainline
    10.2
    Code:
    image_file_count_reduction:                                        0
    image_rewrites:                                                 9606
    image_resized_using_rendered_dimensions:                           0
    image_norewrites_high_resolution:                                  0
    image_rewrites_dropped_intentionally:                           4268
    image_rewrites_dropped_decode_failure:                             0
    image_rewrites_dropped_mime_type_unknown:                       3501
    image_rewrites_dropped_server_write_fail:                          0
    image_rewrites_dropped_nosaving_resize:                           14
    image_rewrites_dropped_nosaving_noresize:                        753
    image_rewrites_dropped_due_to_load:                                0
    image_rewrites_squashing_for_mobile_screen:                        0
    image_rewrite_total_bytes_saved:                            34414954
    image_rewrite_total_original_bytes:                         66018360
    image_rewrite_uses:                                           327882
    image_inline:                                                 271293
    image_webp_rewrites:                                            4664
    image_rewrite_latency_total_ms:                                36800
    image_ongoing_rewrites:                                            0
    image_webp_conversion_gif_timeouts:                                0
    image_webp_conversion_png_timeouts:                                0
    image_webp_conversion_jpeg_timeouts:                               0
    image_webp_alpha_timeouts:                                         0
    image_webp_opaque_timeouts:                                        0
     
  3. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Nice looks like again ~52% image reduction :)
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  5. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  6. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Last edited: Oct 7, 2014
  7. rdan

    rdan Well-Known Member

    5,439
    1,399
    113
    May 25, 2014
    Ratings:
    +2,188
    Local Time:
    3:11 PM
    Mainline
    10.2
    Defer_js and Inline css+BDCache plays large rule/benefit but not fully compatible with my XenForo Setup.
    Even here, I still encounter minor issue that I know related to BDCache+ngx_pagespeed :)
     
  8. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yeah whenever BD Cache has selective CSS as files that should fix it :)
     
  9. s.molinari

    s.molinari New Member

    10
    4
    3
    Aug 31, 2014
    Ratings:
    +4
    Local Time:
    8:11 AM
    Hey George. Very interesting stuff and got me registered here, because I now have a (what might be a stupid) question.:)

    If a CDN were in use, how would or could ngx_pagespeed work?

    Scott
     
  10. rdan

    rdan Well-Known Member

    5,439
    1,399
    113
    May 25, 2014
    Ratings:
    +2,188
    Local Time:
    3:11 PM
    Mainline
    10.2
  11. s.molinari

    s.molinari New Member

    10
    4
    3
    Aug 31, 2014
    Ratings:
    +4
    Local Time:
    8:11 AM
    Thanks RoldanLT.

    Scott
     
  12. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yup @RoldanLT linked thread basically has it all laid out for ngx_pagespeed and CDN usage (with SPDY SSL CDN serving) :)
     
  13. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Another example of PageSpeed in action for my thread at Wordpress - Wordpress Auto Installer + WP Super Cache Plugin [Premium Users] | Centmin Mod Community look at the image reductions for auto conversion from png to webp format !

    Code:
    image_rewrites:                                       142
    image_resized_using_rendered_dimensions:                0
    image_norewrites_high_resolution:                       0
    image_rewrites_dropped_intentionally:                  20
    image_rewrites_dropped_decode_failure:                  0
    image_rewrites_dropped_mime_type_unknown:               0
    image_rewrites_dropped_server_write_fail:               0
    image_rewrites_dropped_nosaving_resize:                 0
    image_rewrites_dropped_nosaving_noresize:              20
    image_rewrites_dropped_due_to_load:                     0
    image_rewrites_squashing_for_mobile_screen:             0
    image_rewrite_total_bytes_saved:                  1082230
    image_rewrite_total_original_bytes:               1455388
    image_rewrite_uses:                                 17165
    image_inline:                                        4646
    image_webp_rewrites:                                   69
    image_rewrite_latency_total_ms:                      8852
    image_webp_conversion_gif_timeouts:                     0
    image_webp_conversion_png_timeouts:                     0
    image_webp_conversion_jpeg_timeouts:                    0
    image_webp_alpha_timeouts:                              0
    image_webp_opaque_timeouts:                             0
     
  14. rdan

    rdan Well-Known Member

    5,439
    1,399
    113
    May 25, 2014
    Ratings:
    +2,188
    Local Time:
    3:11 PM
    Mainline
    10.2
    So I used /tmp/ on my server config :).
    Don't know if it matters since I'm using memcached also :D
     
  15. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    every bit counts :D
     
  16. robbyq92

    robbyq92 New Member

    8
    0
    1
    Jul 9, 2015
    Ratings:
    +1
    Local Time:
    8:11 AM
    1.9.2
    Maria DB 10
    like so much. I have one question.

    If i used that, work for .jpg?

    i see in test only png.
     
  17. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  18. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    another example for ngx_pagespeed via webpagetest.org

    no ngx_pagespeed

    upload_2016-12-5_21-17-41.png

    ngx_pagespeed

    upload_2016-12-5_21-18-4.png

    upload_2016-12-5_21-18-25.png

    content breakdown image size dropped from 19,268,838 bytes for 39 images to 2,201,026 bytes for 41 images

    no ngx_pagespeed

    no-ngx_pagespeed-content-51216.png

    ngx_pagespeed

    ngx_pagespeed-content-51216.png
     
    Last edited: Dec 5, 2016
  19. Amin Sabet

    Amin Sabet Member

    49
    7
    8
    Nov 8, 2015
    Ratings:
    +14
    Local Time:
    2:11 AM
    I'm using ngx_pagespeed primarily for image optimization. Since my sites are photography forums, image optimization is an especially big deal to me.

    Sometimes the results can be dramatic.

    A member posted this 433kb image: https://www.mu-43.com/data/attachments/116/116278-60dec99cefc2e4ae5c662c565d58af10.jpg

    ngx_pagespeed version is 16kb: https://www.mu-43.com/data/attachme...2c565d58af10.jpg.pagespeed.ic.7dFSOFEzOi.webp

    96% file size reduction!

    Here's my site homepage right now without and with ngx_pagespeed: WebPagetest - Visual Comparison

    It's even more essential with mobile on 3G.
     
  20. eva2000

    eva2000 Administrator Staff Member

    53,811
    12,159
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,711
    Local Time:
    5:11 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Looking good and yes 3G mobile can definitely see ngx_pagespeed shine :)