# Memcached\_gzip\_flag

**URL:** <https://www.ruby-forum.com/t/memcached-gzip-flag/225066>\
**Category:** NGINX\
**Created:** [December 10, 2012, 5:16pm UTC](https://www.ruby-forum.com/t/memcached-gzip-flag/225066 "2012-12-10T17:16:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [December 10, 2012, 5:16pm UTC](https://www.ruby-forum.com/t/memcached-gzip-flag/225066/1 "2012-12-10T17:16:35Z")

</div>

I’m running nginx 1.3.9 with memcached\_pass and I have set  
memcached\_gzip\_flag in an attempt to serve gzipped content directly from  
memcached (mainly to save memory on my memcached processes, which get  
pretty  
large). My gzip flag is being detected properly–nginx adds the  
Content-Encoding header–but I get 330 errors saying the content  
encoding is  
incorrect. Every test I’ve made indicates that the data I am storing is  
valid gzipped data. Does anyone have any advice on how to troubleshoot  
this?

Thanks so much!

Posted at Nginx Forum:

> **[memcached\_gzip\_flag](https://forum.nginx.org/read.php?2,233807,233807#msg-233807)**
>
> I'm running nginx 1.3.9 with memcached\_pass and I have set memcached\_gzip\_flag in an attempt to serve gzipped content directly from memcached (mainly to save memory on my memcached processes, which get pretty large). My gzip flag is being detected...

---

<div class="post-metadata">

**Author:** ![tkellen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecae2f/32.png) [@tkellen](https://www.ruby-forum.com/u/tkellen)\
**Post date:** [December 10, 2012, 5:17pm UTC](https://www.ruby-forum.com/t/memcached-gzip-flag/225066/2 "2012-12-10T17:17:10Z")

</div>

PS: I’m writing the data using Dalli ([GitHub - petergoldstein/dalli: High performance memcached client for Ruby](https://github.com/mperham/dalli))  
with  
compression on and raw set to true. Dalli sets the bitmask for  
compression  
to 0x2 (all of this appears to be working correctly).

Posted at Nginx Forum:

> **[Re: memcached\_gzip\_flag](https://forum.nginx.org/read.php?2,233807,233808#msg-233808)**
>
> I'm running nginx 1.3.9 with memcached\_pass and I have set memcached\_gzip\_flag in an attempt to serve gzipped content directly from memcached (mainly to save memory on my memcached processes, which get pretty large). My gzip flag is being detected...

---

<div class="post-metadata">

**Author:** ![tkellen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecae2f/32.png) [@tkellen](https://www.ruby-forum.com/u/tkellen)\
**Post date:** [December 10, 2012, 5:34pm UTC](https://www.ruby-forum.com/t/memcached-gzip-flag/225066/3 "2012-12-10T17:34:07Z")

</div>

Hello!

On Mon, Dec 10, 2012 at 11:16:54AM -0500, tkellen wrote:

> PS: I’m writing the data using Dalli ([GitHub - petergoldstein/dalli: High performance memcached client for Ruby · GitHub](https://github.com/mperham/dalli)) with  
> compression on and raw set to true. Dalli sets the bitmask for compression  
> to 0x2 (all of this appears to be working correctly).

As far as I can tell from [1], it stores zlib stream, not gzip  
(which is a different format on top of the same compression  
algorithm, see zlib.h for details). It likely can be easily  
adapted to use gzip though.

[1] [dalli/lib/dalli/compressor.rb at main · petergoldstein/dalli · GitHub](https://github.com/mperham/dalli/blob/master/lib/dalli/compressor.rb)

–  
Maxim D.

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.

---

<div class="post-metadata">

**Author:** ![tkellen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecae2f/32.png) [@tkellen](https://www.ruby-forum.com/u/tkellen)\
**Post date:** [December 10, 2012, 5:34pm UTC](https://www.ruby-forum.com/t/memcached-gzip-flag/225066/4 "2012-12-10T17:34:42Z")

</div>

On Monday 10 December 2012 20:16:54 tkellen wrote:

> PS: I’m writing the data using Dalli ([GitHub - petergoldstein/dalli: High performance memcached client for Ruby · GitHub](https://github.com/mperham/dalli))  
> with compression on and raw set to true. Dalli sets the bitmask for  
> compression to 0x2 (all of this appears to be working correctly).

But Dalli for compressed data uses zlib wrapper instead of gzip one.

wbr, Valentin V. Bartenev

–

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.

> **[nginx: donation](http://nginx.org/en/donation.html)**

---

<div class="post-metadata">

**Author:** ![tkellen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ecae2f/32.png) [@tkellen](https://www.ruby-forum.com/u/tkellen)\
**Post date:** [December 10, 2012, 6:15pm UTC](https://www.ruby-forum.com/t/memcached-gzip-flag/225066/5 "2012-12-10T18:15:02Z")

</div>

Right you are. Thanks for the second set of eyes! I’ve submitted a PR  
to  
Dalli to add a gzip compressor and I’m using a custom one now. It’s  
working  
wonderfully.

Posted at Nginx Forum:

> **[Re: memcached\_gzip\_flag](https://forum.nginx.org/read.php?2,233807,233816#msg-233816)**
>
> I'm running nginx 1.3.9 with memcached\_pass and I have set memcached\_gzip\_flag in an attempt to serve gzipped content directly from memcached (mainly to save memory on my memcached processes, which get pretty large). My gzip flag is being detected...
