Holy One
Posts: 29
Joined: Mon Jul 02, 2012 5:44 pm
Contact: Website

php zlib compression & apache

Mon Jul 30, 2012 6:38 pm

I was just wondering if anyone had done any testing or fiddling with these options? given the pi's relatively feeble cpu, is it better to turn off all compression of dynamic content via php.ini (zlib.output_compression = Off) and in the relevant apache/lighttpd modules? or is compression benefit/cost performance relative to how much server load you anticipate?

edit: after much googling I found this comment:
Short answer: if your site is efficiently configured, the cost of compression is... zero.

The key is memory caching. Without it, Apache has to process each file request by getting the file from disk and running it through filter modules, such as mod_deflate. This requires disk I/O and compute time. Instead, use a memory cache to store the results after compression. The next time the same file is needed, Apache gets it from the memory cache. No disk I/O. No compression CPU time. The cost of disk I/O and compression is now paid only the first time the file is requested, not every time.
does this stand up with regards the pi?

khh
Posts: 49
Joined: Thu Jul 26, 2012 12:16 am

Re: php zlib compression & apache

Mon Jul 30, 2012 8:45 pm

The raspberry pi has pretty limited memory, so I'm not sure if RAM cache would be a good idea. With lighttpd you configure a directory for cached compressed files. That's how I've set up mine and that seems to work fine, though it's only for static files.

Return to “Networking and servers”