PageSpeed messing with bandwidth counter

Paarsch

Verified User
Joined
Jun 9, 2017
Messages
17
Last week i installed Google's Pagespeed on a CentOS/Apache 2.4 webserver to provide clients with a faster loading website. Although this seems to really help with a lot of sites, I am noticing one big drawback. The sites which have Mod_Pagespeed enabled have a significant increase in bandwidth usage. Where they used to generate around 100mb to 200mb of bandwidth a day, i am now seeing traffic easily going over 1000mb. This is of course a result of a Pagespeed setting that I probably have not set correctly.

i already am tinkering with some of the Pagespeed parameters and at the moment have it setup like this:

Code:
<IfModule !mod_version.c>
  LoadModule version_module /usr/lib64/httpd/modules/mod_version.so
</IfModule>

<IfVersion < 2.4>
  LoadModule pagespeed_module /usr/lib64/httpd/modules/mod_pagespeed.so
</IfVersion>
<IfVersion >= 2.4.2>
  <IfModule !access_compat_module>
    LoadModule access_compat_module /usr/lib64/httpd/modules/mod_access_compat.so
  </IfModule>

  LoadModule pagespeed_module /usr/lib64/httpd/modules/mod_pagespeed_ap24.so
</IfVersion>

<IfModule !mod_deflate.c>
 LoadModule deflate_module /usr/lib64/httpd/modules/mod_deflate.so
</IfModule>
<IfModule pagespeed_module>
    ModPagespeed on
    AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
    ModPagespeedFileCachePath            "/var/cache/mod_pagespeed/"
    ModPagespeedLogDir "/var/log/pagespeed"
    ModPagespeedSslCertDirectory "/etc/pki/tls/certs"
    ModPagespeedSslCertFile /etc/pki/tls/cert.pem

    <Location /pagespeed_admin>
        Order allow,deny
        Allow from localhost
        Allow from 127.0.0.1
        Allow from 213.125.85.50
        SetHandler pagespeed_admin
    </Location>
    <Location /pagespeed_global_admin>
        Order allow,deny
        Allow from localhost
        Allow from 127.0.0.1
        Allow from 213.125.85.50
        SetHandler pagespeed_global_admin
    </Location>

    ModPagespeedStatisticsLogging on
    ModPagespeedMessageBufferSize 100000
</IfModule>
ModPagespeedEnableFilters prioritize_critical_css
ModPagespeedEnableFilters defer_javascript
ModPagespeedEnableFilters sprite_images
ModPagespeedEnableFilters rewrite_images
ModPagespeedEnableFilters recompress_png
ModPagespeedEnableFilters convert_png_to_jpeg,convert_jpeg_to_webp
ModPagespeedEnableFilters collapse_whitespace,remove_comments

When going through the stats of the website i am noticing that by far the most bandwidth and pagehits are taken up by the internal Serf/1.3.9 (mod_pagespeed/1.13.35.2-0). This is however internal traffic and as far as i am concerned should not be counted as bandwidth usage. This leaves me with a couple of questions:

- What setting am i missing that is causing the 10 fold of bandwidth usage.
- How can i exclude the Serf traffic from ramping up the bandwidth tally.
- Is anybody else seeing this trend when using the combination of Cloudlinux/DirectAdmin/Apache/Pagespeed?

Kind Regards,

John.
 
Most likely this is because you're rewriting/converting images and ModPagespeed is unable to cache them. That will cause subrequests again and again. Make sure the converted images are actually written to disk (or memcache if you enable it) and the htaccess sets a ttl on the .webp extension.
Depending on the site (lots of images) it also might be normal behaviour because all currently cached images (in browsers) are useless and need to be retrieved again, because the extension/file changed.
Keep in mind that MP works dynamically and might or might not server the converted file. (default it only converts about max 8-10 images at a time). Another thing is that it might inline images as data:BASE64ENCODED resulting in larger (but faster) loading pages.
 
@zEitEr; Hmm, i never thought of that. thank you! But isn't that a bit symptomatic treatment?

One thing i never understood though is how DirectAdmin can calculate the amount of bandwidth used by looking at the log.

@sysdev; I did look at the logs of PageSpeed for failed image caching; strange this is though, even when PageSpeed is turned off (through .htaccess) it still would use more bandwidth then normal.
 
There are *.bytes logs under domains. Directadmin uses them to calculate HTTP/HTTPS traffic usage. It's up to you whether or not to exclude those lines from logging. If you don't like this way you might need to reconfigure PageSpeed module.
 
There are *.bytes logs under domains. Directadmin uses them to calculate HTTP/HTTPS traffic usage. It's up to you whether or not to exclude those lines from logging. If you don't like this way you might need to reconfigure PageSpeed module.

Well, yes you are absolutely right. I have been diving a bit deeper into the use of PageSpeed and see that i'll have to review my initial plans for the implementation.
Though, i will probably have to exclude from logging sometime in the future.

Anyway, thanks for your suggestions and support!
 
Back
Top