Welcome! Log In Create A New Profile

Advanced

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

Maxim Dounin
October 04, 2013 01:46PM
Hello!

On Fri, Oct 04, 2013 at 12:52:28PM -0400, ddutra wrote:

> Maxim,
> Thank you again.
>
> About my tests, FYI I had httpauth turned off for my tests.
>
> I think you nailed the problem.
>
> This is some new information for me.
>
> So for production I have a standard website which is php being cached by
> fastcgi cache. All static assets are served by nginx, so gzip_static will do
> the trick if I pre-compress them and it will save a bunch of cpu.
> What about the cached .php page? Is there any way of saving the gziped
> version to cache?

Yes, but it's not something trivial to configure. Best aproach
would likely be to unconditionally return gzipped version to
cache, and use gunzip to uncompress it if needed, see
http://nginx.org/r/gunzip.

> Another question - most static assets are being worked in some way by
> ngx_pagespeed and the optimized assets are cached. That means .js, .css and
> images too. How does gzip works in this case? nginx gzips it everytime it
> gets hit? ngx_pagespeed caches gzipped content? I am confused.

I haven't looked at what pagespeed folks did in their module, but
likely they don't cache anything gzip-related and the response is
gzipped every time (much like with normal files). It might also
conflict with gzip_static, as pagespeed will likely won't be able
to dig into gzipped response.

> Maybe it would be better to drop ngx_pagespeed, bulk optimize every image on
> source, minify all .js and .css, and let it all run on nginx without
> ngx_pagespeed cache. Can you share you experience on that?

In my experience, any dynamic processing should be avoided to
maximize performance. Static files should be optimized (minified,
pre-gzipped) somewhere during deployment process, this allows to
achieve smallest resource sizes while maintaining best
performance.

> And one last question, is there any way to output $gzip_ratio on the
> response headers in order to do a easy debbuging?

No, as $gzip_ratio isn't yet known while sending response headers.
Use logs instead. Or, if you just want to see how files are
compressed with different compression levels, just use gzip(1) for
tests.

--
Maxim Dounin
http://nginx.org/en/donation.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutra October 03, 2013 12:34PM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

Maxim Dounin October 03, 2013 01:14PM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutra October 03, 2013 03:00PM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

Maxim Dounin October 04, 2013 08:06AM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutra October 04, 2013 09:43AM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutra October 04, 2013 09:52AM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

Maxim Dounin October 04, 2013 11:12AM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutra October 04, 2013 12:52PM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

Maxim Dounin October 04, 2013 01:46PM

Re: Nginx Fastcgi_cache performance - Disk cached VS tmpfs cached VS serving static file

ddutra October 04, 2013 01:43PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 269
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready