Mod_rails on 256meg slicehost vps crashing often

I’m running ubuntu hardy 8.04 with mod_rails on a site that gets about
1000 hits a day. the site runs perfectly fine if there are only a
handful of users making request. but when the site gets busy i run out
of memory because of too many passenger processes.

i have 256MB RAM and 512 swap.

i have tuned down some of the apache settings:

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 5

StartServers 3 MinSpareServers 3 MaxSpareServers 3 MaxClients 50 MaxRequestsPerChild 0 StartServers 3 MaxClients 50 MinSpareThreads 3 MaxSpareThreads 3 ThreadsPerChild 10

i’m not sure what i should do next. maybe i should switch to a mongrel
cluster? are there any settings in in passenger i should be looking at
to optimize this configuration?

i don’t mind if the site slows down a little bit i just don’t want it
crashing everyday! please help!

reading through the mod_rails help i see i can change a few parameters

#define DEFAULT_LOG_LEVEL 0
#define DEFAULT_MAX_POOL_SIZE 2
#define DEFAULT_POOL_IDLE_TIME 300
#define DEFAULT_MAX_INSTANCES_PER_APP 0

i found these located in Configuration.cpp. do i need to recompile
passenger? or can i just set this as a global value somewhere like in
the virtual host declaration?

On 30 Jun 2008, at 05:14, Scott K. wrote:

reading through the mod_rails help i see i can change a few parameters

#define DEFAULT_LOG_LEVEL 0
#define DEFAULT_MAX_POOL_SIZE 2
#define DEFAULT_POOL_IDLE_TIME 300
#define DEFAULT_MAX_INSTANCES_PER_APP 0

i found these located in Configuration.cpp. do i need to recompile
passenger? or can i just set this as a global value somewhere like in
the virtual host declaration?

http://www.modrails.com/documentation/Users%20guide.html#_resource_control_and_optimization_options

And yes, it’s in the vhost config.

Best regards

Peter De Berdt

http://www.modrails.com/documentation/Users%20guide.html#_resource_control_and_optimization_options

And yes, it’s in the vhost config.

Best regards

Peter De Berdt

ok thanks. i found out that i need to set PassengerMaxPoolSize to 2.

I have tried setting this in apache2.conf and in my virtual host.

<VirtualHost *:80>
SetEnv RAILS_ENV production
SetEnv PassengerMaxPoolSize 2
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /u1/app/domain/public
ServerAdmin [email protected]
ErrorLog /u1/app/domain/log/error_log
CustomLog /u1/app/domain/log/access_log common

and restarting apache but my max is still set to 6:

----------- General information -----------
max = 6
count = 2
active = 0
inactive = 2

any other ideas?

how were you able to report the PassengerMaxPoolSize for the vhost?

I’ve set mine properly in my vhost but ‘sudo passenger-status’ tells
me the global setting I think, and not the setting for the vhost i am
checking on.

thoughts?

On Jun 30, 12:18 pm, Scott K. [email protected]

i got it. i had to do the following:

PassengerMaxPoolSize 2

since it was not an environment variable.