rm_mongrel at cheapcomplexdevices.com
2007-Apr-12 18:03 UTC
[Mongrel] What''s mongrel doing when it''s idle.
A totally idle mongrel seems to wake up about once a second doing a little stuff like: select(4, [3], [], [], {0, 999696}) = 0 (Timeout) gettimeofday({1176400534, 112594}, NULL) = 0 select(4, [3], [], [], {0, 0}) = 0 (Timeout) time(NULL) = 1176400534 time(NULL) = 1176400534 gettimeofday({1176400534, 113841}, NULL) = 0 gettimeofday({1176400534, 114138}, NULL) = 0 over and over. I realize it''s not a big deal to do so little so infrequently; but wondering why it wakes up to do anything at all. Any reason whatever it''s polling for can''t just be added to the select() conditions? I only noticed because on an extremely overloaded server (I have dozens of virtual machines running on a box here and memory on each is limited and each are running quite a few web servers) I was mildly surprised to see that the mongrel tasks didn''t get swapped out completely. The waking up once a second is probably why. Ron PS: Equally curious to me as that irb seems to wake up a few times a second too; but that''s less of a concern because I don''t leave irbs running on purpose.
On Thu, 12 Apr 2007 11:03:36 -0700 (PDT) rm_mongrel at cheapcomplexdevices.com wrote:> > A totally idle mongrel seems to wake up about once a second doing > a little stuff like: > select(4, [3], [], [], {0, 999696}) = 0 (Timeout) > gettimeofday({1176400534, 112594}, NULL) = 0 > select(4, [3], [], [], {0, 0}) = 0 (Timeout) > time(NULL) = 1176400534 > time(NULL) = 1176400534 > gettimeofday({1176400534, 113841}, NULL) = 0 > gettimeofday({1176400534, 114138}, NULL) = 0 > over and over. > > I realize it''s not a big deal to do so little so infrequently; but > wondering why it wakes up to do anything at all. Any reason > whatever it''s polling for can''t just be added to the select() > conditions?Ruby uses select() to do it''s IO processing and thread control, but only after you start one thread. Ruby doesn''t put a timeout parameter into the select call unless there''s a thread sleeping. If you have threads waiting for IO, and have someone running Mongrel from the console, and you don''t have a thread calling sleep once a second, then... CTRL-C won''t exit the process on most systems. So, most ruby code that uses threads throws in a bogus sleeping thread that doesn''t do much. -- Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu http://www.zedshaw.com/ http://www.awprofessional.com/title/0321483502 -- The Mongrel Book http://mongrel.rubyforge.org/
Possibly Parallel Threads
- Rsync hang on HP-UX 10.20
- Dovecot Authentication Problem - Help pls!
- smbd's using up 100% of all cpu's and load avg slowly going up
- smbd's using up 100% of all cpu's and load avg slowly going up
- smbd's using up 100% of all cpu's and load avg slowly going up