[Backgroundrb-devel] Backgroundrb spiking CPU after first run on Mongrel cluster

Matthew pelargir at gmail.com
Sat Mar 3 22:54:57 EST 2007


I've been troubleshooting this problem for several hours now and haven't
been able to figure out what's wrong. I have two boxes, dev and prod, both
are identical except that prod uses Ruby 1.8.5 and dev uses 1.8.4. Both are
running Slave 1.2.0, Daemons 1.0.5, and Backroundrb 0.2.1.

The behavior I'm seeing is this. When I first start Backgroundrb, this is
what the process list looks like:

cwarner  80608  0.0  1.6 57852 50480  ??  S    10:28PM
0:03.36/usr/local/bin/ruby18 /usr/local/bin/mon
cwarner  80611  0.0  1.6 58768 51356  ??  S    10:28PM
0:03.59/usr/local/bin/ruby18 /usr/local/bin/mon
cwarner  80614  0.0  1.6 57944 50628  ??  S    10:28PM
0:03.48/usr/local/bin/ruby18 /usr/local/bin/mon
cwarner  80618  0.0  1.6 57384 50060  ??  S    10:28PM
0:03.26/usr/local/bin/ruby18 /usr/local/bin/mon
cwarner  80804  0.0  1.3 46872 39688  ??  S    10:37PM   0:02.43 ruby:
backgroundrb (ruby)
cwarner  80805  0.0  0.7 21512 20548  ??  S    10:37PM   0:00.07 ruby:
backgroundrb_logger (ruby)
cwarner  80806  0.0  0.7 21468 20556  ??  S    10:37PM   0:00.06 ruby:
backgroundrb_results (ruby)

My four Mongrels in the cluster sitting out there, and the three
backgroundrb processes. I then proceed to generate a worker using MiddleMan
via IRB, get the auto generated job key, look up the worker, and then delete
him. All goes well, and the process list still looks like what I posted
above. I can do this as many times as I want to via IRB and nothing goes
wrong. However, when I try to call the same code through a Rails action,
Backgroundrb doesn't behave. The browser just sits there spinning. Examining
the process list yields:

cwarner 80934 92.8  1.3 46936 39752  ??  R    10:45PM   0:02.07 ruby:
backgroundrb (ruby)
cwarner 80804  0.1  1.3 47072 39888  ??  S    10:37PM   0:02.60 ruby:
backgroundrb (ruby)
cwarner 80608  0.0  1.6 57852 50480  ??  S    10:28PM
0:03.36/usr/local/bin/ruby18 /usr/local/bin/mong
cwarner 80611  0.0  1.6 58768 51356  ??  S    10:28PM
0:03.59/usr/local/bin/ruby18 /usr/local/bin/mong
cwarner 80614  0.0  1.6 57944 50628  ??  R    10:28PM
0:03.51/usr/local/bin/ruby18 /usr/local/bin/mong
cwarner 80618  0.0  1.6 57384 50060  ??  S    10:28PM
0:03.26/usr/local/bin/ruby18 /usr/local/bin/mong
cwarner 80805  0.0  0.7 21512 20548  ??  S    10:37PM   0:00.07 ruby:
backgroundrb_logger (ruby)
cwarner 80806  0.0  0.7 21468 20556  ??  S    10:37PM   0:00.06 ruby:
backgroundrb_results (ruby)
cwarner 80936  0.0  0.0  1484   828  p3  S+   10:45PM   0:00.00 grep ruby

Aha! An extra Backgroundrb process that's spiking the CPU. I've let the
browser sit there until it times out, and the Backgroundrb process will
still be there, spiking the CPU. If I stop Backgroundrb at this point, the
extra process is still there. I have to kill it manually to get rid of it.

Something else I've noticed is that, once this process is out there, even if
I try creating new workers via IRB, the call to MiddleMan.new_worker just
sits there. So this definitely appears to be a problem with the way
Backgroundrb and my Mongrel clusters are interacting, but I'm not sure where
to even begin. It's frustrating that this isn't happening on the dev box.
I've tried to figure out what could be different between the boxes, but
other than the Ruby versions, I'm not seeing anything.

I'm out of options. Does anyone have any ideas?

Thanks,
Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070303/3c154ef6/attachment.html 


More information about the Backgroundrb-devel mailing list