From a7f5f17ba2047ef7143465f612007ea81871a79e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 3 May 2011 01:05:11 +0000 Subject: add client_header_buffer_size tuning parameter We're changing our default to 1K buffers to save memory. This should reduce memory usage of idle clients and lower pressure on the MRI GC. Rails applications using session cookies (the default) may want to up this to 2K or more. --- lib/rainbows/client.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/rainbows/client.rb') diff --git a/lib/rainbows/client.rb b/lib/rainbows/client.rb index 7387c44..4608f53 100644 --- a/lib/rainbows/client.rb +++ b/lib/rainbows/client.rb @@ -4,6 +4,8 @@ require "io/wait" # this class is used for most synchronous concurrency models class Rainbows::Client < Kgio::Socket + include Rainbows::ProcessClient + def read_expire Time.now + Rainbows.keepalive_timeout end @@ -16,7 +18,7 @@ class Rainbows::Client < Kgio::Socket def timed_read(buf) expire = nil begin - case rv = kgio_tryread(0x1000, buf) + case rv = kgio_tryread(HBUFSIZ, buf) when :wait_readable return if expire && expire < Time.now expire ||= read_expire @@ -26,6 +28,4 @@ class Rainbows::Client < Kgio::Socket end end while true end - - include Rainbows::ProcessClient end -- cgit v1.2.3-24-ge0c7