Combating nginx 499 HTTP responses during flash traffic scenario

Eric Wong normalperson at
Fri Nov 2 19:38:03 UTC 2012

Tom Burns <tom.burns at> wrote:
> On Tue, Oct 30, 2012 at 5:37 PM, Eric Wong <normalperson at> wrote:
> > Tom Burns <tom.burns at> wrote:
> > > We'd prefer to not have to fork unicorn for this change.  How do you
> > > feel about merging this or a derivative thereof?  I can develop this
> > > further if you can send me what you'd want.
> >
> > Sure thing!
> Below is a patch for this functionality.
> We're going to be testing this further next week before rolling it out
> in production.

Thank you for the patch and I'm looking forward to hearing about how it
works for you guys.  I'd love to hear feedback from anybody else who is
trying this, too.

> It's still pre-writing the entire HTTP/1.1 header start, but as just
> two strings.  It could be shortened to just pre-writing HT but I
> thought writing that full word looked cleaner.
> Please let me know what you think.

Everything looks good for stock configurations.  The ERROR_XXX_RESPONSE
constants should have "HTTP/1.1 " removed if used with this option, too.
That requires keeping track of whether or not we've written out
"HTTP/1.1 ", yet.

(I don't think there's much benefit in using constants for rarely-used
 error responses, either.  Most of those were inherited from Mongrel
 which had many client-triggered errors to deal with)

> The only thing it's missing from your TODO is enforcing
> tcp_nodelay/tcp_nopush as I wasn't sure where was the best place to do
> the enforcement.

It should probably be done inside Unicorn::Configurator#commit!

> Never done this inline with GMail, sorry in advance if formatting gets
> destroyed :)

"git apply" runs cleanly on this message :)

You'll probably find it more reliable and easier to use "git send-email".
The git-send-email manpage has an example for using it with
"git format-patch" + GMail SMTP.  Using "git format-patch" also lets
you preserve your original commit message/authorship information.

More information about the mongrel-unicorn mailing list