Forum

Gzip (or other) Encoding (again)

Bruno Baketaric
4 July 2013, 10:28
Hi Hugo,

I'd like to see Encoding Support in Hiawatha. I've seen the old thread regarding this feature: http://www.hiawatha-webserver.org/forum/topic/357

I think that ddoing an extra step of greating and uploading a Gzipp'ed (or Bzip'ed, or...) Version of a file, is quite unhandy - and for me one of the main reasons I didn't give Hiawatha a try in a production environment.

On the other hand, I understand that compressing a file "per Request" is a waste of CPU-Cycles. But there's a solution: IMHO lighttpd does this the right way. lighttpd doesn't compress "streams" from (FastCGI-)Backends like PHP - that's easy to do in PHP (zlib.output_compression, etc...), but:
In lighttpd you can set a Cache Directory for Compressed files. If a File is requested with any compression method supported by lighttpd, it checks for a PRE-compressed Version of that file in the configured cache directory (and also compares last-modified timestamp). If a compressed version is found lighttd serves that one, if not, it compresses the file ONCE and stores it in his cache directory.

Regarding performance, you just loose some I/O for checking file existance and comparing timestamps with lighttpd's approach (and these stat()-calls can also be cached, I think).

And of course you can configure, which file types should be compressed.

Wouldn't this also be an option for Hiawatha? I'd really like to see it...

Kind Regards

Bruno
Hugo Leisink
8 July 2013, 19:41
I'll think about it. If Hiawatha was used by many people, it would be worth the effort. But since only a few people use it and my spare time has become very limited since my second son was born a few months ago, I'm not going to make any promise.
This topic has been closed.