Rainbows! Rack HTTP server user/dev discussion
 help / Atom feed
From: Claudio Poli <claudio-3HQ/CcOImoi171pxa8y+qA@public.gmane.org>
To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Subject: Transfer encoding chunked disables HAProxy gzip compression
Date: Fri, 2 Aug 2013 21:26:18 +0200
Message-ID: <CD8781D3-288B-4B61-85ED-16B8B15A90E9@gmail.com> (raw)

Hello,
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.

Thanks!
_______________________________________________
Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
http://rubyforge.org/mailman/listinfo/rainbows-talk
Do not quote signatures (like this one) or top post when replying


             reply index

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02 19:26 Claudio Poli [this message]
     [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

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://bogomips.org/rainbows/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CD8781D3-288B-4B61-85ED-16B8B15A90E9@gmail.com \
    --to=claudio-3hq/ccoimoi171pxa8y+qa@public.gmane.org \
    --cc=rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Rainbows! Rack HTTP server user/dev discussion

Archives are clonable:
	git clone --mirror https://bogomips.org/rainbows-public
	git clone --mirror http://ou63pmih66umazou.onion/rainbows-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.rainbows
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.rainbows

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox