Apache’s ModPagespeed by Google and NGINX’s ngx_pagespeed are near-identical versions of the pagespeed module for two different webservers.
The pagespeed module is commonly used to optimize resources automatically, such as images and stylesheets. However, the nature of this module means the HTML and assets need to be modified in real-time, causing a delay in web page response times.
In our never-ending quest to make websites faster, we’ve benchmarked the two modules to see which one is faster and more scalable.
Here’s our setup:
- Blank, default WordPress website running PHP-fpm 7.4.9 with PHP processed by Apache served through NGINX as a reverse proxy.
- Both ngx_pagespeed and ModPagespeed were installed and switched on and off through config files.
- To reduce outside factors, we’ve bypassed the CDN proxy and resolved the domain directly
- Identical configuration directives were used
- Server processing time was computed by subtracting the total from the SSL handshake
- The same VPS server (2 Cores, 4 GB) with Plesk installed was used.
We first used the following command to fetch the homepage 20 times:
for i in {1..20}; do curl -sX GET -o /dev/null -w "HTTP Code: %{http_code}\tDNS: %{time_namelookup}\tSSL: %{time_appconnect}\tTTFB: %{time_starttransfer}\tTotal Time: %{time_total}\n" "https://equal.cynderhost.com/" --resolve equal.cynderhost.com:443:169.60.224.11; done
Pagespeed Off: HTTP Code: 200 DNS: 0.000096 SSL: 0.286483 TTFB: 0.515401 Total Time: 0.516978 HTTP Code: 200 DNS: 0.000097 SSL: 0.259993 TTFB: 0.442080 Total Time: 0.445712 HTTP Code: 200 DNS: 0.000106 SSL: 0.224957 TTFB: 0.415866 Total Time: 0.417935 HTTP Code: 200 DNS: 0.000107 SSL: 0.262826 TTFB: 0.443732 Total Time: 0.445840 HTTP Code: 200 DNS: 0.000120 SSL: 0.261643 TTFB: 0.446762 Total Time: 0.447973 HTTP Code: 200 DNS: 0.000109 SSL: 0.228474 TTFB: 0.416888 Total Time: 0.418586 HTTP Code: 200 DNS: 0.000111 SSL: 0.283084 TTFB: 0.460672 Total Time: 0.462374 HTTP Code: 200 DNS: 0.000102 SSL: 0.311652 TTFB: 0.496876 Total Time: 0.498015 HTTP Code: 200 DNS: 0.000099 SSL: 0.284603 TTFB: 0.460346 Total Time: 0.463445 HTTP Code: 200 DNS: 0.000098 SSL: 0.252091 TTFB: 0.419133 Total Time: 0.421483 HTTP Code: 200 DNS: 0.000099 SSL: 0.232195 TTFB: 0.408021 Total Time: 0.410264 HTTP Code: 200 DNS: 0.000105 SSL: 0.233824 TTFB: 0.410060 Total Time: 0.411809 HTTP Code: 200 DNS: 0.000103 SSL: 0.232645 TTFB: 0.416207 Total Time: 0.418653 HTTP Code: 200 DNS: 0.000108 SSL: 0.247795 TTFB: 0.425461 Total Time: 0.426673 HTTP Code: 200 DNS: 0.000099 SSL: 0.284453 TTFB: 0.457713 Total Time: 0.461524 HTTP Code: 200 DNS: 0.000102 SSL: 0.236373 TTFB: 0.409977 Total Time: 0.412244 HTTP Code: 200 DNS: 0.000099 SSL: 0.242598 TTFB: 0.416461 Total Time: 0.514403 HTTP Code: 200 DNS: 0.000097 SSL: 0.270029 TTFB: 0.455102 Total Time: 0.456959 HTTP Code: 200 DNS: 0.000097 SSL: 0.221154 TTFB: 0.399366 Total Time: 0.400816 HTTP Code: 200 DNS: 0.000095 SSL: 0.289938 TTFB: 0.461303 Total Time: 0.463231 Average Server Processing Time: 0.18841
Apache ModPagespeed: HTTP Code: 200 DNS: 0.000113 SSL: 0.287891 TTFB: 0.496561 Total Time: 0.500331 HTTP Code: 200 DNS: 0.000099 SSL: 0.248649 TTFB: 0.446792 Total Time: 0.448681 HTTP Code: 200 DNS: 0.000119 SSL: 0.256122 TTFB: 0.575414 Total Time: 0.577067 HTTP Code: 200 DNS: 0.000101 SSL: 0.247441 TTFB: 0.461080 Total Time: 0.462829 HTTP Code: 200 DNS: 0.000098 SSL: 0.270975 TTFB: 0.478333 Total Time: 0.480266 HTTP Code: 200 DNS: 0.000100 SSL: 0.301894 TTFB: 0.506097 Total Time: 0.507839 HTTP Code: 200 DNS: 0.000099 SSL: 0.235768 TTFB: 0.438984 Total Time: 0.440616 HTTP Code: 200 DNS: 0.000098 SSL: 0.292051 TTFB: 0.585596 Total Time: 0.637211 HTTP Code: 200 DNS: 0.000100 SSL: 0.237881 TTFB: 0.430295 Total Time: 0.431855 HTTP Code: 200 DNS: 0.000109 SSL: 0.385499 TTFB: 0.587163 Total Time: 0.589140 HTTP Code: 200 DNS: 0.000110 SSL: 0.247940 TTFB: 0.443631 Total Time: 0.464923 HTTP Code: 200 DNS: 0.000101 SSL: 0.280352 TTFB: 0.494061 Total Time: 0.517246 HTTP Code: 200 DNS: 0.000104 SSL: 0.270014 TTFB: 0.471998 Total Time: 0.473986 HTTP Code: 200 DNS: 0.000112 SSL: 0.256081 TTFB: 0.467936 Total Time: 0.471381 HTTP Code: 200 DNS: 0.000110 SSL: 0.349760 TTFB: 0.559765 Total Time: 0.562085 HTTP Code: 200 DNS: 0.000110 SSL: 0.260500 TTFB: 0.568708 Total Time: 0.569945 HTTP Code: 200 DNS: 0.000100 SSL: 0.266476 TTFB: 0.458883 Total Time: 0.460992 HTTP Code: 200 DNS: 0.000096 SSL: 0.257761 TTFB: 0.448572 Total Time: 0.450637 HTTP Code: 200 DNS: 0.000101 SSL: 0.285926 TTFB: 0.492328 Total Time: 0.493736 HTTP Code: 200 DNS: 0.000106 SSL: 0.289849 TTFB: 0.490343 Total Time: 0.492160 Average Server Processing Time: 0.2252
NGINX ngx_pagespeed: HTTP Code: 200 DNS: 0.000094 SSL: 0.342287 TTFB: 0.607774 Total Time: 0.609251 HTTP Code: 200 DNS: 0.000102 SSL: 0.322519 TTFB: 0.491073 Total Time: 0.543676 HTTP Code: 200 DNS: 0.000094 SSL: 0.258854 TTFB: 0.489193 Total Time: 0.491097 HTTP Code: 200 DNS: 0.000094 SSL: 0.321711 TTFB: 0.538368 Total Time: 0.540109 HTTP Code: 200 DNS: 0.000093 SSL: 0.342480 TTFB: 0.480733 Total Time: 0.534885 HTTP Code: 200 DNS: 0.000093 SSL: 0.301418 TTFB: 0.444763 Total Time: 0.499226 HTTP Code: 200 DNS: 0.000093 SSL: 0.282373 TTFB: 0.489012 Total Time: 0.490452 HTTP Code: 200 DNS: 0.000105 SSL: 0.296106 TTFB: 0.516014 Total Time: 0.517087 HTTP Code: 200 DNS: 0.000091 SSL: 0.315118 TTFB: 0.533018 Total Time: 0.534407 HTTP Code: 200 DNS: 0.000100 SSL: 0.373177 TTFB: 0.546775 Total Time: 0.549167 HTTP Code: 200 DNS: 0.000093 SSL: 0.336115 TTFB: 0.518854 Total Time: 0.520134 HTTP Code: 200 DNS: 0.000093 SSL: 0.284673 TTFB: 0.414328 Total Time: 0.497068 HTTP Code: 200 DNS: 0.000093 SSL: 0.321615 TTFB: 0.532275 Total Time: 0.533769 HTTP Code: 200 DNS: 0.000098 SSL: 0.291430 TTFB: 0.431096 Total Time: 0.480873 HTTP Code: 200 DNS: 0.000093 SSL: 0.331407 TTFB: 0.513530 Total Time: 0.515578 HTTP Code: 200 DNS: 0.000119 SSL: 0.219409 TTFB: 0.384338 Total Time: 0.406132 HTTP Code: 200 DNS: 0.000095 SSL: 0.280427 TTFB: 0.424080 Total Time: 0.478170 HTTP Code: 200 DNS: 0.000096 SSL: 0.284712 TTFB: 0.469151 Total Time: 0.567737 HTTP Code: 200 DNS: 0.000114 SSL: 0.271808 TTFB: 0.414094 Total Time: 0.479016 HTTP Code: 200 DNS: 0.000093 SSL: 0.284337 TTFB: 0.434289 Total Time: 0.484868 Average Server Processing Time: 0.21054
Loader.io results (50 simultaneous threads)
Pagespeed | Req/s | Avg. Resp (ms) |
Off | 46.9 | 1057 |
Apache | 35.1 | 1390 |
NGINX | 38.5 | 1285 |
Overall, NGINX running ngx_pagespeed is about 6% faster when it comes to server-processing without load, and 9% faster when under load. We can also see that there is a significant difference when the Pagespeed module is activated. However, it’s important to note that while the initial server response may be slower, the site may actually load faster overall since resources are smaller and optimized.
For example:
Pagespeed On:
Pagespeed Off:
That’s almost a 40% reduction in page size!
At CynderHost, our customers are able to take advantage of the speed-boost Pagespeed provides through our custom, optimized Pagespeed rules, available to everyone on our High Performance plans.