# Mod\_rails on 256meg slicehost vps crashing often

**URL:** <https://www.ruby-forum.com/t/mod-rails-on-256meg-slicehost-vps-crashing-often/141721>\
**Category:** Rails\
**Created:** [June 30, 2008, 4:55am UTC](https://www.ruby-forum.com/t/mod-rails-on-256meg-slicehost-vps-crashing-often/141721 "2008-06-30T04:55:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [June 30, 2008, 4:55am UTC](https://www.ruby-forum.com/t/mod-rails-on-256meg-slicehost-vps-crashing-often/141721/1 "2008-06-30T04:55:51Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [June 30, 2008, 5:14am UTC](https://www.ruby-forum.com/t/mod-rails-on-256meg-slicehost-vps-crashing-often/141721/2 "2008-06-30T05:14:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [June 30, 2008, 9:22am UTC](https://www.ruby-forum.com/t/mod-rails-on-256meg-slicehost-vps-crashing-often/141721/3 "2008-06-30T09:22:12Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [June 30, 2008, 2:54pm UTC](https://www.ruby-forum.com/t/mod-rails-on-256meg-slicehost-vps-crashing-often/141721/4 "2008-06-30T14:54:18Z")

</div>

> [Phusion Passenger users guide index](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](http://domain.com)  
ServerAlias [www.domain.com](http://www.domain.com)  
DocumentRoot /u1/app/domain/public  
ServerAdmin removed\_email\_address@domain.invalid  
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?

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [August 5, 2008, 7:01am UTC](https://www.ruby-forum.com/t/mod-rails-on-256meg-slicehost-vps-crashing-often/141721/5 "2008-08-05T07:01:57Z")

</div>

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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![skirkpatrick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@skirkpatrick](https://www.ruby-forum.com/u/skirkpatrick)\
**Post date:** [June 30, 2008, 6:18pm UTC](https://www.ruby-forum.com/t/mod-rails-on-256meg-slicehost-vps-crashing-often/141721/6 "2008-06-30T18:18:56Z")

</div>

i got it. i had to do the following:

PassengerMaxPoolSize 2

since it was not an environment variable.
