* client_header_buffer_size tuning in rainbows.git
@ 2011-05-03 1:47 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2011-05-03 1:47 UTC (permalink / raw)
This will be in the next release.
It mainly affects Thread/Actor/Fiber-based concurrency models since
those have an independent (userspace) buffer for client headers.
The default is now only 1K (matching nginx) whereas the previous
hardcoded value was 16K. If it can't fit in 1K, it'll read again
and append to the previous 1K buffer, and so on...
Lowering header buffer sizes lowers memory usage for sites with many
idle connections. With only 1000 clients, header buffers alone would be
16M in memory usage, 10K clients => 160M. If new clients frequently
connect, this will put more pressure on GC to run.
Typical HTTP header sizes are smaller than 1K. Most Rails sites use
larger headers because the sessions are stored in a cookie, so they end
up being in the 1K - 2K range from some quick investigations I did.
== Rails cookie sessions users:
This may cause more recv(2)/read(2) syscalls per request. If this
syscall is measurable overhead (I doubt it is), increase
client_header_buffer_size to what your expected session cookie payload
Unicorn is much simpler since it only has one client to worry about.
Unicorn allocates one 16K buffer and never releases/shrinks it for
the duration of the process (though it can grow up to 112K).
Thanks for reading!
 There's a hard-coded limit of 112K to prevent DoS in the
 search the web, some sites have done research on them
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] only message in thread
only message in thread, other threads:[~2011-05-03 1:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-03 1:47 client_header_buffer_size tuning in rainbows.git 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).