PageSpeed Image Optimization Bug

68 views
Skip to first unread message

Harnek Sidhu

unread,
Mar 14, 2015, 5:48:37 PM3/14/15
to ngx-pagesp...@googlegroups.com
Hi,

I have been running into an issue with PageSpeed's image optimization functionality. I have noticed that when I request a webpage from Nginx for the first time, PageSpeed will optimize the image on the server side but it will not send the optimized version of it (it will not change the src link). When I refresh the page, it will send me the optimized version by changing the src link. 

Is there anyway to get PageSpeed to give the optimized image on the first attempt?

My Nginx Configuration is set up as follows:

pagespeed On;
    pagespeed FileCachePath "/var/cache/ngx_pagespeed/";
    pagespeed RewriteLevel CoreFilters;
    pagespeed EnableFilters inline_preview_images,resize_mobile_images;
    pagespeed AdminPath /pagespeed_admin;
    pagespeed LogDir /var/log/pagespeed;

    pagespeed FileCacheSizeKb            102400;
    pagespeed FileCacheCleanIntervalMs   36000000;
    pagespeed FileCacheInodeLimit        500000;
    pagespeed LRUCacheKbPerProcess     8192;
    pagespeed LRUCacheByteLimit        16384;

    pagespeed LRUCacheKbPerProcess     50000;
    pagespeed LRUCacheByteLimit        10000000;

    pagespeed Statistics on;
    pagespeed StatisticsLogging on;

    pagespeed InPlaceResourceOptimization off;

    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

 
    server {
        listen       80;
 
    location / {
        proxy_pass  http://www.website.ca;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location ~ ^/pagespeed_admin {
    }

    location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
     add_header "" "";
    }
    location ~ "^/pagespeed_static/" { }
    location ~ "^/ngx_pagespeed_beacon$" { }

    }




Joshua Marantz

unread,
Mar 14, 2015, 6:05:42 PM3/14/15
to ngx-pagesp...@googlegroups.com
Why do you want to delay delivering HTML to your clients?  That means an image-rich HTML page might take quite a long time to deliver when there is a cold server cache.  Our system is designed as it is because we feel it's better UX to get a page of unoptimized images than to wait for all of them to be optimized.  Keep in mind that this only matters as content turns over or when a new site is brought up.  Once the server is serving requests, the cache should stay warm.

Having said that, it's possible to increase the rewrite deadline to whatever number of milliseconds you like:
  pagespeed RewriteDeadlinePerFlushMs deadline_value_in_milliseconds;

-Josh


--
You received this message because you are subscribed to the Google Groups "ngx-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ngx-pagespeed-di...@googlegroups.com.
Visit this group at http://groups.google.com/group/ngx-pagespeed-discuss.
For more options, visit https://groups.google.com/d/optout.

Harnek Sidhu

unread,
Mar 14, 2015, 6:25:34 PM3/14/15
to ngx-pagesp...@googlegroups.com
Hi Josh,

Thanks it works! I needed it to be optimized because we are using PageSpeed for benchmarking purposes.

Thanks! 
Reply all
Reply to author
Forward
0 new messages