unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Xavier Noria <fxn@hashref.com>
To: mongrel-unicorn@rubyforge.org
Subject: Unicorn and streaming in Rails 3.1
Date: Sat, 25 Jun 2011 18:08:59 +0200	[thread overview]
Message-ID: <BANLkTika2jE-ZFk1Q0VgWxAk44LHg16LJg@mail.gmail.com> (raw)

Streaming works with Unicorn + Apache. Both with and without deflating.

My understanding is that Unicorn + Apache is not a good combination
though because Apache does not buffer, and thus Unicorn has no fast
client in front. (I don't know which is the ultimate technical reason
Unicorn puts such an emphasis on fast clients, but will do some
research about it.)

I have seen in

    http://unicorn.bogomips.org/examples/nginx.conf

the comment

    "You normally want nginx to buffer responses to slow
    clients, even with Rails 3.1 streaming because otherwise a slow
    client can become a bottleneck of Unicorn."

If I understand how this works correctly, nginx buffers the entire
response from Unicorn. First filling what's configured in
proxy_buffer_size and proxy_buffers, and then going to disk if needed
as a last resort. Thus, even if the application streams, I believe the
client will receive the chunked response, but only after it has been
generated by the application and fully buffered by nginx. Which
defeats the purpose of streaming in the use case we have in mind in
Rails 3.1, which is to serve HEAD as soon as possible.

Is that comment in the example configuration file actually saying that
Unicorn with nginx buffering is not broken? I mean, that if your
application has some actions with stream enabled and you put it behind
this setup, the content will be delivered albeit not streamed?

If that is correct. Is it reasonable to send to nginx the header
X-Accel-Buffering to disable buffering only for streamed responses? Or
is it a very bad idea? If it is a real bad idea, is the recommendation
to Unicorn users that they should just ignore this new feature?
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


             reply	other threads:[~2011-06-25 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-25 16:08 Xavier Noria [this message]
2011-06-25 20:16 ` Unicorn and streaming in Rails 3.1 Eric Wong
2011-06-25 22:23   ` Xavier Noria
2011-06-25 20:33 ` Eric Wong

Reply instructions:

You may reply publicly 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://yhbt.net/unicorn/

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

  git send-email \
    --in-reply-to=BANLkTika2jE-ZFk1Q0VgWxAk44LHg16LJg@mail.gmail.com \
    --to=fxn@hashref.com \
    --cc=mongrel-unicorn@rubyforge.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

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).