about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-06-13 22:17:14 +0000
committerEric Wong <normalperson@yhbt.net>2011-06-13 22:17:14 +0000
commitb1d8d3de991ebc5b7d655f2e8a1294129021db8a (patch)
treedd61a65c601e021ca23dac92783643dcdbba6311
parentc1cac62571b543ac8e9f7203f8c315bb75516a20 (diff)
downloadunicorn-b1d8d3de991ebc5b7d655f2e8a1294129021db8a.tar.gz
These TCP settings are a closer match to the behavior of
Unix domain sockets and what users expect for fast streaming
responses even if nginx can't provide them just now...
-rw-r--r--lib/unicorn/configurator.rb8
-rw-r--r--lib/unicorn/socket_helper.rb6
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index 0b84d53..bdb77ec 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -264,8 +264,9 @@ class Unicorn::Configurator
   #
   #   This has no effect on UNIX sockets.
   #
-  #   Default: +false+ (Nagle's algorithm enabled) in \Unicorn,
-  #   +true+ in Rainbows!
+  #   Default: +true+ (Nagle's algorithm disabled) in \Unicorn,
+  #   +true+ in Rainbows!  This defaulted to +false+ in \Unicorn
+  #   3.x
   #
   # [:tcp_nopush => true or false]
   #
@@ -279,7 +280,8 @@ class Unicorn::Configurator
   #
   #   This has no effect on UNIX sockets.
   #
-  #   Default: +true+ in \Unicorn 3.4+, +false+ in Rainbows!
+  #   Default: +false+
+  #   This defaulted to +true+ in \Unicorn 3.4 - 3.7
   #
   # [:ipv6only => true or false]
   #
diff --git a/lib/unicorn/socket_helper.rb b/lib/unicorn/socket_helper.rb
index 8548276..3519a7b 100644
--- a/lib/unicorn/socket_helper.rb
+++ b/lib/unicorn/socket_helper.rb
@@ -27,9 +27,9 @@ module Unicorn
       # same default value as Mongrel
       :backlog => 1024,
 
-      # since we don't do keepalive, we'll always flush-on-close and
-      # this saves packets for everyone.
-      :tcp_nopush => true,
+      # favor latency over bandwidth savings
+      :tcp_nopush => false,
+      :tcp_nodelay => true,
     }
     #:startdoc: