From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS33070 50.56.128.0/17 X-Spam-Status: No, score=1.3 required=3.0 tests=MSGID_FROM_MTA_HEADER, RDNS_NONE shortcircuit=no autolearn=no version=3.3.2 Path: news.gmane.org!not-for-mail From: Claudio Poli Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Re: Transfer encoding chunked disables HAProxy gzip compression Date: Sat, 3 Aug 2013 02:20:59 +0200 Message-ID: References: <20130802205810.GA9486@dcvr.yhbt.net> <20130802231115.GA24708@dcvr.yhbt.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1375490977 1258 80.91.229.3 (3 Aug 2013 00:49:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Aug 2013 00:49:37 +0000 (UTC) To: Rainbows! list Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Sat Aug 03 02:49:39 2013 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=OfWFHSTfkHkwlUHT5wV2jP9mWPH+bQ998Mfeq99G39I=; b=d1WnRCIxGsuU2hn/7S/nYJ/lvYE1RVMbtdpImwo0Q53O1mYkmgVkKfAmHJR41iaIJI 8DFGs+oZypEfo6lOpmazzh8rqoVvy9dMcN4SfpV3LvNHaFBHl7PqQtA3vZsVJpXGIV6A Iy2kQYuZmCjAA1JrfVFo3jUgqyBiD4gN84dy/oWhQfGodWL9D/3RMvJUGXKPJAjPBfMe 7Ee8IE2V3UCQUpmKLk4t2aEHWm0WVVkEN16S7vLqHqfJ/kCvZYpesvRbJtoCVJeObTbN S94OPY9mQ/YKNpkn8eYI4uTC05ra120TadNkQ9oNlfCRquxUKPmhzTaHjT2OnwUV3grG 2QAA== X-Received: by 10.14.215.1 with SMTP id d1mr7624609eep.10.1375489263305; Fri, 02 Aug 2013 17:21:03 -0700 (PDT) In-Reply-To: <20130802231115.GA24708-yBiyF41qdooeIZ0/mPfg9Q@public.gmane.org> X-Mailer: Apple Mail (2.1508) X-Gm-Message-State: ALoCoQnvTIzbtly9C+YmFdCPNF7UPSObcs860YC2lvMqmwtvZPAqThfUuL60ERP/xSNcFHP0jB6L X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Broken-Reverse-DNS: no host name found for IP address 50.56.192.79 Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:506 Archived-At: Received: from [50.56.192.79] (helo=rubyforge.org) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V5Q2N-0006ok-2I for gclrrg-rainbows-talk@m.gmane.org; Sat, 03 Aug 2013 02:49:39 +0200 Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id D3F962E219; Sat, 3 Aug 2013 00:49:36 +0000 (UTC) Received: from mail-ea0-f182.google.com (mail-ea0-f182.google.com [209.85.215.182]) by rubyforge.org (Postfix) with ESMTP id EC2A32E1B1 for ; Sat, 3 Aug 2013 00:21:05 +0000 (UTC) Received: by mail-ea0-f182.google.com with SMTP id o10so595918eaj.27 for ; Fri, 02 Aug 2013 17:21:03 -0700 (PDT) Received: from [172.20.10.3] (adsl-ull-66-200.46-151.net24.it. [151.46.200.66]) by mx.google.com with ESMTPSA id e1sm4015703eev.8.2013.08.02.17.21.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 02 Aug 2013 17:21:02 -0700 (PDT) On 03/ago/2013, at 01:11, Eric Wong wrote: > Claudio Poli wrote: >> Ok, in staging everything seems to work correctly, we had to handle a >> case where one of our internal services couldn't communicate through >> compressed responses. > > Good to know! I'm still battling a little to find the perfect configuration, my deploy script (and rails) takes RACK_ENV seriously, but the -E switch for Rainbows! and Unicorn, as I understand, it's another thing that might or not might inject Rack::ContentLength and Rack::Chunked. I admit that I was not able to see a Content-Length response when querying the app server with curl's --http1.0 . But at least we have compression back. >> Willy told me the HAProxy compression issue for chunked request might >> be solved in Sept. > > I will be curious to see performance numbers for your cluster with > gzipping in HAProxy vs Rack::Deflater once this is fixed in HAProxy. Yeah, there are definitely up and downsides in this approach to centralize gzip responses. HAProxy has advanced parameters to fine tune the compression process, you can set it to automatically skip gzipping when CPU reaches a user defined % threshold and the like. To run a basic I'll probably just use the defaults. Centralizing gzip was awesome for us because our applications servers are layered out in a distribute manner. Now it has become pretty common to have multiple apps serving in the cloud sharing same-path HTTP endpoints through both simple and advanced routing logic at balancer level. For example we delegate uploads and heavy streaming-related code to node.js, while our API and frontend are Rails. There are also a number of small services written in javascript, ruby and occasionally java. It's also common that those apps communicate internally each other, via http or other message queues. So, Rainbows! is configured to accept connections through both tcp (only from the load balancers) and unix socket; the rest of the local stack will call Rainbows! directly on the unix socket, while serving http requests coming in from HAProxy destined the public. Enabling gzip on the internal main rails app wreak havoc because libraries might not be ready to handle gzip responses, it's the case of the Request library for node.js. It does not ask for gzipped responses per-se, but since it is acting as a transparent proxy, the original request is taken from the client and forwarded as-is to Rails, like it was done to it directly. In Node.js this was the point where I had to remove manually gzip headers to communicate internally with Rails (with Rack::Deflater) and without issues. A central point where to produce gzipped responses for the public is pretty spot on for our architecture, since other apps (node.js, etc.) requires it in some cases. I know that it might be confusing, perhaps it's time for a blog post. Thanks, Claudio > _______________________________________________ > 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 _______________________________________________ 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