* 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
Rainbows! Rack HTTP server user/dev discussion
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://yhbt.net/rainbows-public
git clone --mirror http://ou63pmih66umazou.onion/rainbows-public
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V1 rainbows-public rainbows-public/ https://yhbt.net/rainbows-public \
firstname.lastname@example.org email@example.com firstname.lastname@example.org rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org
Example config snippet for mirrors.
Newsgroups are available over NNTP:
note: .onion URLs require Tor: https://www.torproject.org/
code repositories for project(s) associated with this inbox:
AGPL code for this site: git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git