0 Comments

We decided to look into performance issues of our discoverize portals. We used online tools like WebPageTest, PageSpeed Insights, Website Grader, Pingdom Website Speed Test and GTmetrix to analyze the responses to web requests to our portals. Enabling browser caching and bundling JavaScript files were among the most important tasks. We took a look at PageSpeed Module which takes care of many these performance problems, and decided to give it a try.

After installing and configuring PageSpeed Module on a NGINX server we started to route discoverize portals through the NGINX proxy server.

I started with the core filters in PageSpeed Module and added a few which I deemed necessary. Here is our filter configuration:

pagespeed on;
# CoreFilters is default and enables multiple filters
pagespeed RewriteLevel CoreFilters;
# add additional filters
pagespeed EnableFilters defer_javascript,insert_image_dimensions;

And yes, we improved the performance of our portals. Especially for users which visit us frequently and request many pages of the portal. For instance for Caravanmarkt.Info our PageSpeed Insight score went from 76 to 86 (start page), 72 to 81 (search page), 71 to 86 (detail page). The other tools reported similar results. I also tested Glamping.Info, with similar results – this portals’ PageSpeed Insight score was lower to begin with, but improved  by the same amount. The page load time also decreased, but we do not have reliable measurements for that, and it is just one time measurement out of many which have an impact on the user experience.

2015-11-16_16h52_28

Looking at some of the analyses, there is is – of course – further room for improvement. For now we will leave it that way. Next year we will look into the remaining performance issues, for instance first byte time. Now we have a good setup with PageSpeed Module to address many performance issues.

Of course I also ran into some problems. Many filters were not easy for me to understand, since this was the first time we looked into the performance of our websites, and I was new to many concepts. One problem particularly kept haunting me: every five minutes PageSpeed did not bundle the JavaScript files and requested all resources anew. Seems that was due to changing ETags in the headers (bouncing between two ETags). Luckily that only concerns one portal, so for now we can live with that.

0 Comments

To optimize the performance of our discoverize portals we decided to try out the PageSpeed Module. Since we already have a little experience with NGINX, we decided to install NGINX(version 1.8.0) with the PageSpeed Module (version 1.9.32.10) on our CentOS 6 and CentOS 7 servers.

Installation:

  1. use guide: https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source
    1. ngx_pagespeed was not saved as .zip file, but without file extension – adjust the unzip command accordingly
    2. if needed add other modules to the NGINX configuration before installing NGINX, for instance the ngx_http_ssl_module:
        ./configure --add-module=$HOME/ngx_pagespeed-release-${NPS_VERSION}-beta --with-http_ssl_module
    3. If you install with the http_ssl_module you may have to install OpenSSL libraries first. yum install openssl will probably not suffice, yum install openssl-devel will be needed (you may wonder why ./configure states that OpenSSL is not available even though it is installed – what it really needs is openssl-devel).
    4. if only over-installing nginx, do not forget to restart the nginx service (reload will do nothing)
  2. create NGINX init script: https://www.nginx.com/resources/wiki/start/topics/examples/redhatnginxinit/
    1. adjust folder paths in that script:
      1. nginx="/usr/local/nginx/sbin/nginx" (line 22)
      2. NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" (line 25)
    2. give init script sufficient rights: rwxr-xr-x
  3. create log rotation script: http://www.scalescale.com/tips/nginx/how-to-rotate-nginx-logs/

Uninstall:

There is no uninstall parameter in make for NGINX. Just remove the folders and files: sudo rm -f -R /usr/local/nginx && rm -f /usr/local/sbin/nginx && rm -rf /etc/init.d/nginx

Configuration:

  1. configure NGINX as proxy for web site
    1. there are many guides out there, for instance: https://www.nginx.com/resources/admin-guide/reverse-proxy/
    2. proxy_set_header has to be set, so backend server knows which application should reply
    3. proxy_http_version has to be set to 1.1 – otherwise only parts of page may be transferred
  2. enable the module: https://developers.google.com/speed/pagespeed/module/configuration
    1. use tmpfs for the caching folder: https://developers.google.com/speed/pagespeed/module/faq#tmpfs 
  3. configure filters for PageSpeed Module: https://developers.google.com/speed/pagespeed/module/config_filters
    1. let PageSpeed take care of compressing the response: do not activate gzip, PageSpeed will automatically configure it

    2. try out the filters which are not automatically enabled with the RewriteLevel CoreFilters

All in all it is not an easy task to get the PageSpeed Module working, but in the end it is surely easier and faster to let it optimize your web site responses instead of implementing all the different optimizations.

Since our backend server are Windows server we briefly considered using the IISpeed wrapper for the PageSpeed Module, but went with NGINX. Maybe IISpeed is easier to install and to configure. If you have experience using IISpeed, I would like to read a comment about ist usability.