diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-02-06 18:00:08 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-02-09 19:52:09 -0800 |
commit | 1fe42f0f8e7f0902eb02860fb098cbd73ddf4e5d (patch) | |
tree | 8ffd8a58ea498fc581c5371a991a352b60f94102 /lib/unicorn.rb | |
parent | 9d92bb90f0d0a317834a51a01c4271f68697f956 (diff) | |
download | unicorn-1fe42f0f8e7f0902eb02860fb098cbd73ddf4e5d.tar.gz |
Unicorn is only designed for fast internal networks (and loopback); so avoid wasting time with userspace I/O buffering. This should not significantly affect userspace threading on 1.8 in case your application itself is running threads for some (masochistic) reason as long as the clients you're serving directly with Unicorn are fast.
Diffstat (limited to 'lib/unicorn.rb')
-rw-r--r-- | lib/unicorn.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb index 794786a..bc940f0 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -6,6 +6,7 @@ require 'uri' require 'stringio' require 'fcntl' require 'logger' +require 'io/nonblock' # Compiled extension require 'http11' @@ -82,7 +83,7 @@ module Unicorn parser, params = @parser, @params parser.reset params.clear - data = client.readpartial(Const::CHUNK_SIZE) + data = client.sysread(Const::CHUNK_SIZE) nparsed = 0 # Assumption: nparsed will always be less since data will get filled with more @@ -119,7 +120,7 @@ module Unicorn break #done else # Parser is not done, queue up more data to read and continue parsing - chunk = client.readpartial(Const::CHUNK_SIZE) + chunk = client.sysread(Const::CHUNK_SIZE) break if !chunk or chunk.length == 0 # read failed, stop processing data << chunk |