# LZ4 + nginx

**URL:** <https://www.ruby-forum.com/t/lz4-nginx/217024>\
**Category:** NGINX\
**Created:** [February 20, 2012, 1:35am UTC](https://www.ruby-forum.com/t/lz4-nginx/217024 "2012-02-20T01:35:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 20, 2012, 1:35am UTC](https://www.ruby-forum.com/t/lz4-nginx/217024/1 "2012-02-20T01:35:09Z")

</div>

Just a feature request,

Would be nice to have nginx support for LZ4 (like gzip static  
support), to have an alternative compression method built in…

> **[GitHub - lz4/lz4: Extremely Fast Compression algorithm](https://github.com/lz4/lz4)**
>
> Extremely Fast Compression algorithm. Contribute to lz4/lz4 development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![stimpy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/779978/32.png) [@stimpy](https://www.ruby-forum.com/u/stimpy)\
**Post date:** [February 20, 2012, 10:27am UTC](https://www.ruby-forum.com/t/lz4-nginx/217024/2 "2012-02-20T10:27:18Z")

</div>

On Monday 20 February 2012 04:34:24 Ryan B. wrote:

> Just a feature request,
> 
> Would be nice to have nginx support for LZ4 (like gzip static  
> support), to have an alternative compression method built in..
> 
> [http://code.google.com/p/lz4/](http://code.google.com/p/lz4/)

Are there any browser that supports it?

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![stimpy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/779978/32.png) [@stimpy](https://www.ruby-forum.com/u/stimpy)\
**Post date:** [February 21, 2012, 12:33pm UTC](https://www.ruby-forum.com/t/lz4-nginx/217024/3 "2012-02-21T12:33:15Z")

</div>

sorry, I assumed the decryption would’ve been done by nginx rather  
than the browser

---

<div class="post-metadata">

**Author:** ![stimpy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/779978/32.png) [@stimpy](https://www.ruby-forum.com/u/stimpy)\
**Post date:** [February 21, 2012, 2:15pm UTC](https://www.ruby-forum.com/t/lz4-nginx/217024/4 "2012-02-21T14:15:46Z")

</div>

On Tuesday 21 February 2012 15:32:28 Ryan B. wrote:

> sorry, I assumed the decryption would’ve been done by nginx rather  
> than the browser

It seems that you suggest:

read a lz4 file or stream → decode lz4 → encode gzip → serve to  
browser

instead of:

read a gzip file or stream → serve to browser

..so, where’s the profit?

wbr, Valentin V. Bartenev

---

<div class="post-metadata">

**Author:** ![stimpy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/779978/32.png) [@stimpy](https://www.ruby-forum.com/u/stimpy)\
**Post date:** [February 29, 2012, 8:44pm UTC](https://www.ruby-forum.com/t/lz4-nginx/217024/5 "2012-02-29T20:44:10Z")

</div>

You could use BTRFS with its “compression=lzo” mount-option, available  
since Linux 2.6.38. [1]

I don’t know if LZ4 and Snappy will integrated into Linux 3.4, but you  
can try them out pulling changes from  
[4] [Public Git Hosting - linux-2.6/btrfs-unstable.git/summary](http://repo.or.cz/w/linux-2.6/btrfs-unstable.git)  
(dev/compression-squad branch)

Compared to LZO, LZ4 doesn’t show any measurable performance increase  
for read-only access.

–  
Mark

[1] [https://btrfs.wiki.kernel.org/](https://btrfs.wiki.kernel.org/)  
[2] [btrfs: Add lzo compression support [LWN.net]](http://lwn.net/Articles/411577/)  
[3]  
[Btrfs LZO Compression Performance - Phoronix](http://www.phoronix.com/scan.php?page=article&item=btrfs_lzo_2638&num=2)  
[4b]  
[http://www.mail-archive.com/removed\_email\_address@domain.invalid/msg14884.html](http://www.mail-archive.com/removed_email_address@domain.invalid/msg14884.html)

Am 21. Februar 2012 12:32 schrieb Ryan B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![stimpy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/779978/32.png) [@stimpy](https://www.ruby-forum.com/u/stimpy)\
**Post date:** [July 17, 2012, 8:27pm UTC](https://www.ruby-forum.com/t/lz4-nginx/217024/6 "2012-07-17T20:27:03Z")

</div>

read a lz4 file or stream → serve to browser

Can I also request LZ4 compression be a supported feature for direct  
delivery to a browser ? As a provider this means less overhead of a  
compressed stream on each connection, meaning that there’s less of a  
bandwidth vs. CPU tradeoff.

I’ve begun requesting different browsers support this natively as well.

The real question I suppose is: How did gzip come to be used ? With the  
performance differences in speed and compression I envision a shift to  
LZ4.

Thoughts ?

Posted at Nginx Forum:

> **[Re: LZ4 + nginx](https://forum.nginx.org/read.php?2,222697,228656#msg-228656)**
>
> Just a feature request, Would be nice to have nginx support for LZ4 (like gzip static support), to have an alternative compression method built in.. http://code.google.com/p/lz4/ \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ nginx mailing list
