From be1542f47f0ea4cfb93a7b8dd5e94627f4a8b51f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 2 May 2009 23:44:52 -0700 Subject: Make speculative accept() faster for the common case Only do speculative accept on the previous ready set of listeners. This makes it less CPU-intensive to have per-process debug listeners configured. Unfortunately, this makes non-primary listeners unable to accept connections if the server is under extremely heavy load and speculative accept() on the previous listener is always succeeding and hogging the process. Fortunately, this is an uncommon case. --- lib/unicorn.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/unicorn.rb b/lib/unicorn.rb index 05866df..71d2c45 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -517,9 +517,7 @@ module Unicorn # we're probably reasonably busy, so avoid calling select() # and do a speculative accept_nonblock on every listener # before we sleep again in select(). - if nr != 0 # (nr < 0) => reopen logs - ready = LISTENERS - else + if nr == 0 # (nr < 0) => reopen logs master_pid == Process.ppid or exit(0) alive.chmod(nr += 1) begin -- cgit v1.2.3-24-ge0c7