• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Nginx pagespeed on SSL

Floren

Well-known member
#1
I recently compiled Nginx with pagespeed support. While everything works OK with http, there is a different story with https. I'm already using SPDY and I'm more prone to optimize myself the server, instead of adding the bulk of Pagespeed. After compilation, the binary passes from 400KB (without pagespeed) to 4.3MB (with pagespeed)!

Looking forward to your input.
 

p4guru

Well-known member
#3
woah how the hell did it go from 400kb to 4.3MB ? can you run side by side compare through gtmetrix.com for http vs https ? where is the bulk of the increases ? rewritten images ? rewritten css or jss ?

tried one by one disabling pagespeed filters to see if any or all are the culprits ?
 

Floren

Well-known member
#5
You're referring to the actual nginx binary file? Did you check if debug symbols were stripped after compilation?
Obviously, ya. :)
I build 2 different rpm's, one with debug and the other without but the differences in size are minimal.
Someone else on GitHub compiled Nginx with Pagespeed for CentOS 5, his packages are 5MB while mines were 4.3MB.
My packages size compiled with naxsi, pam and wevdav+ modules (no pagespeed):
Code:
# ls -lah | grep nginx
-rw-r--r--. 1 root root 415K May 17 03:48 nginx-1.4.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 147K May 17 03:48 nginx-common-1.4.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 446K May 17 03:48 nginx-debug-1.4.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 436K May 17 03:48 nginx-naxsi-1.4.1-1.el6.x86_64.rpm
For example, nginx-1.4.1-1.el6.x86_64.rpm contains just the Nginx binary. Same thing with nginx-debug and nginx-naxsi. I decided that Pagespeed is not for me. As previously said, I can do everything into actual php software without the huge bulk added by pagespeed into Nginx.

IMO, Pagespeed is useful for hosts or companies who have a large number of vhosts managed by inexperienced users who have no idea how to optimize their web software. By setting the Pagespeed settings globally, the host does not have to worry if the user installs some weird coded app that doubles the bandwidth usage (for example). Which is not the case with XF.
 

p4guru

Well-known member
#6
Ah size of binary!

So have you done tests against your default vs ngx_pagespeed enabled site to compare the actual page loading and visual rendering time of your sites (2 may differ page load times versus visual render time) ?

Or you just concerned with binary size ?

I do agree if you already optimize your sites manually, you won't notice that much difference. But depends on the site I guess.
 

Floren

Well-known member
#7
Nginx rule of thumb: bigger is the binary, slower things run.
I only enabled the dns prefetch as it was the only thing I was interested. No difference is speed or performance. Then I realized you can do everything Pagespeed does yourself, for example:
<link rel="dns-prefetch">

All they do is a sort of regex on each page, by adding fancy things for you. I will do that myself. :)
I mean, static pages are already cached by Nginx and for the dynamic stuff we have APC and Memcached, why would I use their Memcached implementation for example?
 

Marcus

Well-known member
#10
@Floren how do you achieve a 400k nginx file? These settings build a 4 MB nginx file on Centos 6.5 64bit:

ls -lah /usr/local/sbin/nginx
-rwxr-xr-x 1 root root 3.9M Jan 14 03:41 /usr/local/sbin/nginx

./configure --with-http_ssl_module --with-http_spdy_module
--without-http_browser_module
--without-http_charset_module
--without-http_empty_gif_module
--without-http_geo_module
--without-mail_pop3_module
--without-mail_imap_module
--without-mail_smtp_module
--without-http_auth_basic_module
--without-http_autoindex_module
--without-http_limit_req_module
--without-http_limit_conn_module
--without-http_browser_module
--without-http_geo_module
--without-http_map_module
--without-http_memcached_module
--without-http_referer_module
--without-http_proxy_module
--without-http_scgi_module
--without-http_split_clients_module
--without-http_ssi_module
--without-http_upstream_ip_hash_module
--without-http_userid_module
--without-http_uwsgi_module
 
Last edited:

Floren

Well-known member
#12
The previous version I had it at 740KB, the 1.4.4 is at 1003KB with all standard modules enabled, plus external DAV and PAM:
# ls -lah /usr/sbin/nginx
-rwxr-xr-x. 1 root root 1003K Dec 28 10:32 /usr/sbin/nginx
# nginx -V
nginx version: nginx/1.4.4
TLS SNI support enabled
configure arguments: --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx --with-select_module --with-poll_module --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_spdy_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/client --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --http-scgi-temp-path=/var/lib/nginx/scgi --with-mail --with-mail_ssl_module --with-cpp_test_module --add-module=nginx-dav-ext-module --add-module=ngx_http_auth_pam_module-1.3
Before you compile, do ./compile --help to see all modules available. For example the memcached module is enabled by default, there is no need to type it. To be sure is true, I added the $memcached_key and memcached_pass variables into a location and got no config errors when i restarted Nginx.
i think Floren is referring to the compressed rpm package size ?? as he mentioned binary being 4.3MB
Binary was over 4Mb with pagespeed enabled, without it and optional add-ons it is 700KB.
 
Last edited:

RoldanLT

Well-known member
#19
After I posted post #16
My forum is not displaying correctly, most specially the admin view and guest view.
So I decided to remove ngx_pagespeed totally.
The one you linked from gtmetrix was tested without ngx_pagespeed.
I will not use ngx_pagespeed for now until they support https/spdy correctly.
https://developers.google.com/speed/pagespeed/module/https_support
 
#20
I'd be interested in the expected CPU overhead with mod_pagespeed. In particular for medium-to-large forums.
I have a slightly smaller than medium size forum and there's no noticeable CPU hit after the initial caching of files. It scrapes and caches files when they're requested so as the bulk of your site gets cached there's no performance hit as it's just serving the cached, optimized files. No more CPU overhead than running the gzip-static-module.

The binary size does grow quite a bit. My binary compiled with -Os without Pagespeed is 644KB. With -Os and Pagespeed it's ~4MB.

The average page load time on my Pagespeed-enabled XenForo forum is 0.36 seconds.