LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > Getting Lots of Ruby Processes

Reply
 
Thread Tools Display Modes
  #1  
Old 09-11-2006, 02:54 PM
jp_n9 jp_n9 is offline
Member
 
Join Date: Sep 2006
Posts: 38
Default Getting Lots of Ruby Processes

I am testing LS on a VPS running RH9. It is not beng accessed by more than 3 people. Probably none of them concurrently.

When I restart the server I have 2 ruby instances. In the 6 or so hours since I restarted this morning, I now have 16 ruby instances. Eventually I end up with about 25 - 30 of them and the Rails application stops responding.

UPDATE:

2 hours later - Now up to 22 ruby instances.

Any idea what might be going on here?

Last edited by jp_n9; 09-11-2006 at 04:45 PM.. Reason: Typo
Reply With Quote
  #2  
Old 09-11-2006, 05:36 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
What is your "max connection" setting? which version of LSAPI has been installed?
Is that possible for me to login and take a look at the server?
Reply With Quote
  #3  
Old 09-11-2006, 07:00 PM
amalik amalik is offline
Member
 
Join Date: Aug 2006
Posts: 18
This is funny, I am getting the same kind of issue, I have set the max connections for each of my VHosts to 3, but if this morning I noticed I had 16 processes.. at 20mb each, it eats up my half gig pretty easily..

I also wonder why LS starts a new RailsRunner when I click on a link in my RoR generated page, even though it already has 6 processes started (this is after I did a graceful restart)

I have NO users. None. Nada. Just me. and I don't have aborted connections or anything like that at all.

I'm using LSWS 2.2 and the latest version of the ruby-lsapi 1.6 gem. The backend database is postgres.
Reply With Quote
  #4  
Old 09-11-2006, 07:35 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
When LSWS being started gracefully, all associated ruby processes should be killed after all pending requests has been served. The new LSWS instance will start it own group of ruby processes.
The problem is that ruby processes won't die after being killed by LSWS. We spent some time on work around on this issue.
Please upgrade to ruby-lsapi 1.7, if the problem persist, I need to take a look.
Reply With Quote
  #5  
Old 09-11-2006, 08:29 PM
jp_n9 jp_n9 is offline
Member
 
Join Date: Sep 2006
Posts: 38
Quote:
Originally Posted by mistwang View Post
What is your "max connection" setting? which version of LSAPI has been installed?
Is that possible for me to login and take a look at the server?
Max connection is set to 300. I believe it is LSAPI version 1.6.

I'll send you the login in a private message.

There are now 36 ruby processes that have been started.

Last edited by jp_n9; 09-11-2006 at 08:30 PM.. Reason: Update
Reply With Quote
  #6  
Old 09-12-2006, 03:35 AM
amalik amalik is offline
Member
 
Join Date: Aug 2006
Posts: 18
Quote:
Originally Posted by mistwang View Post
When LSWS being started gracefully, all associated ruby processes should be killed after all pending requests has been served. The new LSWS instance will start it own group of ruby processes.
The problem is that ruby processes won't die after being killed by LSWS. We spent some time on work around on this issue.
Please upgrade to ruby-lsapi 1.7, if the problem persist, I need to take a look.
I updated to 1.7 and it seems to be holding much better when I use "ab". The process count doesn't increase.

lsapi 1.7 seems about 3-5% slower (vs 1.6) on the same machine though, but that's just a rough calc. database intensive pages seem to be around 10-15% slower, but that is just off of one reading so it may be way off.

btw, I didn't have any problem with the ruby processes not dying when I stopped LSWS, it is just that even though I had 6 already up and running with 0 requests, if I clicked on a link, it would fire up a new one, which doesn't really make sense to me..

Is there some tech spec as to how many HTTP connections are pooled per RailsRunner (ruby-lsapi) process?

thx,

-Amr
Reply With Quote
  #7  
Old 09-12-2006, 04:47 AM
thijs thijs is offline
Member
 
Join Date: Sep 2006
Posts: 20
I've had the same issues, it sometimes builds up a huge number of processes and eats up all the available memory.

I did notice another thing, I'm running a few Rails 1.0 apps and they broke down with the new 2.2.1 release.

/home/***/app/current/../vendor/rails/activerecord/lib/active_record/base.rb:991:`method_missing': undefined method `clear_active_connections!' for ActiveRecord::Base:Class (NoMethodError)
from /usr/local/lsws/fcgi-bin/RailsRunner.rb:9

The 1.1 apps work great. I haven't seen the processes get out of hand since I moved the 1.0 apps back to Mongrel. Maybe this has something to do with it?
Reply With Quote
  #8  
Old 09-12-2006, 05:31 AM
jp_n9 jp_n9 is offline
Member
 
Join Date: Sep 2006
Posts: 38
Overnight it grew to 50 processes, causing the app to stop responding. Now I just get the 503 Service Unavailable error.

Did the "Graceful Restart", and that killed all the processes and restarted 2. Here we go again...
Reply With Quote
  #9  
Old 09-12-2006, 07:50 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
jp_n9:

Please upgrade ruby LSAPI to 1.7. Your 'Max connection' is way too high, your VPS does not have enough memory to start 300 ruby processes. your server could be DoS attacked by a simple request flood. please try '10' first. I I will take a look at your server if the problem persist with 1.7 release.

Amr,
LSWS 2.2.1 + LSAPI 1.7 will close the DB connection established during initialization, so the first request will be slow down a little, but the subsequent requests should be processed as fast as before.

Thijs,

Looks like 'clear_active_connections!' is a new function for rails 1.1, we need to implement something similar for 1.0 to deal with the DB connections.
Reply With Quote
  #10  
Old 09-12-2006, 08:04 AM
jp_n9 jp_n9 is offline
Member
 
Join Date: Sep 2006
Posts: 38
Quote:
Originally Posted by mistwang View Post
jp_n9:

Please upgrade ruby LSAPI to 1.7. Your 'Max connection' is way too high, your VPS does not have enough memory to start 300 ruby processes.
I didn't understand that "Max connection" == "Max Ruby Processes", otherwise I would have set it much lower.

Even still, it would seem that something was wrong if it keeps spawning new processes when at most two users are ever accessing it at once (most likely only one at a time).
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setup for Rails via Litespeed Ruby LSAPI Justin Ruby/Rails 2 12-08-2007 07:19 PM
Ruby LSAPI 2.4 and PHP LSAPI 3.1 released mistwang News 0 04-24-2007 03:35 PM
Keep ruby RailsRunner.rb's running all the time? inspirix Install/Configuration 3 04-05-2007 01:19 PM
Expected memory usage? subBlue Install/Configuration 4 10-20-2006 02:39 PM
Ruby LSAPI 1.6 Released xing News 0 08-22-2006 11:23 AM


All times are GMT -7. The time now is 10:30 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.