Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
* Transfer encoding chunked disables HAProxy gzip compression
@ 2013-08-02 19:26 Claudio Poli
       [not found] ` <CD8781D3-288B-4B61-85ED-16B8B15A90E9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Claudio Poli @ 2013-08-02 19:26 UTC (permalink / raw)
  To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw

story time.

I was investigating why suddenly our service become slow in response times, currenrly the app is served through Rainbows! behind HAProxy.

It turns out that the problem is HAProxy, which we use as frontend/load balancer *and* for gzip compression of responses from backends.

HAProxy 1.5dev19 disabled automatic response compression for responses that have Transfer-Encoding: chunked from backends.
I found out by downgrading haproxy as last resort and asking the developer what's up with compression being disabled from one release to another.
We had some reports from our automated tools that something was wrong with gzip but it was so rare we didn't care that much, until today.

There are certain rules in HAProxy to successfully enable automatic gzip compression in responses.
The author told me that he had to disable compression for chunked responses in the latest version due to bad code in HAProxy, but it is still enabled for fixed content-length responses.

So, I tried to study rainbows and unicorn internals a bit (-N switch, -E 'development, deploy, none') to attempt and disable chunked middleware and replace with a Rack::ContentLength, so if and when the body can be enumerated my responses would have a fixed size length to feed the client.

It doesn't work: I tried to place them in config.ru, in rails' application.rb, tried the -N switch, messed with -E but in staging every response that comes out are of type http/1.1 chunked requests.

So I went ahead and added Rack::Deflater to live with the chunked response types and enable gzip compression as well, even if the cpu spent time compressing moved from one load balancer to the app server.

I would like to know more about this behavior and based on which factors Rainbows! or Unicorn set and pick the transfer-encoding or content-lenght to use.

Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-08-03  2:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-02 19:26 Transfer encoding chunked disables HAProxy gzip compression Claudio Poli
     [not found] ` <CD8781D3-288B-4B61-85ED-16B8B15A90E9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-02 20:03   ` Claudio Poli
     [not found]     ` <9C3CB455-F4F3-4DF4-BF67-1801547FE1B7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-02 20:46       ` Eric Wong
     [not found]         ` <20130802204647.GA7479-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-08-02 21:00           ` Eric Wong
     [not found]             ` <20130802210004.GB9486-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-08-02 21:35               ` Claudio Poli
2013-08-02 21:49               ` Claudio Poli
2013-08-02 20:58   ` Eric Wong
     [not found]     ` <20130802205810.GA9486-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-08-02 22:34       ` Claudio Poli
     [not found]         ` <FE4BFDCF-538B-4D2D-8991-FE0047DF52AA-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-02 23:11           ` Eric Wong
     [not found]             ` <20130802231115.GA24708-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-08-03  0:20               ` Claudio Poli
     [not found]                 ` <E85CF5AB-7FF6-4BE8-BAAC-5416E14D4A14-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-03  1:06                   ` Eric Wong
     [not found]                     ` <20130803010627.GA4521-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org>
2013-08-03  1:53                       ` Claudio Poli
     [not found]                         ` <9580D763-16FA-4DB5-8CA7-0648DD6788CD-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-03  2:30                           ` Eric Wong

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).