diff options
-rw-r--r-- | lib/rainbows.rb | 11 | ||||
-rwxr-xr-x | t/t0040-keepalive_requests-setting.sh | 5 |
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb index 3f9058e..a8bfa78 100644 --- a/lib/rainbows.rb +++ b/lib/rainbows.rb @@ -1,8 +1,15 @@ # -*- encoding: binary -*- require 'kgio' require 'unicorn' -# the value passed to TCP_DEFER_ACCEPT actually matters in Linux 2.6.32+ -Unicorn::SocketHelper::DEFAULTS[:tcp_defer_accept] = 60 +Unicorn::SocketHelper::DEFAULTS.merge!({ + # the value passed to TCP_DEFER_ACCEPT actually matters in Linux 2.6.32+ + :tcp_defer_accept => 60, + + # keep-alive performance sucks without this due to + # write(headers)-write(body)-read + # because we always write headers and bodies with two calls + :tcp_nodelay => true, +}) module Rainbows diff --git a/t/t0040-keepalive_requests-setting.sh b/t/t0040-keepalive_requests-setting.sh index aee6cd3..81194f1 100755 --- a/t/t0040-keepalive_requests-setting.sh +++ b/t/t0040-keepalive_requests-setting.sh @@ -6,11 +6,6 @@ t_begin "setup and start" && { rainbows_setup $model 50 666 rtmpfiles curl_out curl_err grep 'keepalive_timeout 666' $unicorn_config - ed -s $unicorn_config <<EOF -,s/listen.*/&, :tcp_nodelay => true/ -w -EOF - grep nodelay $unicorn_config rainbows -E none -D env.ru -c $unicorn_config rainbows_wait_start } |