Apache/Passenger Configuration

57 views
Skip to first unread message

Alan

unread,
Feb 18, 2011, 5:04:46 PM2/18/11
to Phusion Passenger Discussions
Can someone please recommend some tuning options for an Apache/
Passenger configuration. Our server seems to run fine most of the
time, but then goes out of control and maxes out all CPU cores to
100%. Memory does not seem to be an issue during the time of the
problems. Getting into the server via SSH is extremely slow, but
usually the issue is resolved after restarting apache.

Current Configuration:

- Server is a quad core 3.0Ghz w/ 4GB of RAM.
- 8 different rails applications
- Ubuntu 10.04 x64 Server
- Apache 2.2.14
- Ruby EE 1.8.6-20090610
- Passenger 3.0.2

*********************************************************************************************************************************************************
APACHE CONF
*********************************************************************************************************************************************************
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
<IfModule mpm_worker_module>
StartServers 5
MinSpareThreads 5
MaxSpareThreads 10
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule>

*********************************************************************************************************************************************************
PASSENGER CONF
*********************************************************************************************************************************************************
PassengerMaxPoolSize 30
PassengerMaxInstancesPerApp 20
PassengerPoolIdleTime 0
PassengerMaxRequests 100
PassengerHighPerformance on

AliQuli

unread,
Feb 21, 2011, 8:09:09 AM2/21/11
to Phusion Passenger Discussions
You should stress test your apps using a tool like JMeter, and review
the systemic performance of your server using tools like ps, vmstat
(sar is pretty neat, although not many systems have that installed).
What you're looking to achieve is optimal throughput and avoidance of
livelock under heavy loads. Typically too few CPU cycles for MySQL or
too many context switches (when on the same server as apache), cause
these and stress test is the only way to determine the appropriate
configuration.

Hope that helps

regards
Ali
syed...@7vals.com

Ramin K

unread,
Feb 21, 2011, 2:26:21 PM2/21/11
to Phusion Passenger Discussions
I'd try this setting, which cuts down on file system stats though
it'll take an extra 10 seconds longer for Passenger to restart when
you touch restart.txt
PassengerStatThrottleRate 10

The setting that looks the most wrong is this one. Unless you're
running super alpha software in devel you should remove that line. At
worst it should be a minimum of 10000 IMO.
PassengerMaxRequests 100

PassengerMaxPoolSize 30 and PassengerMaxInstancesPerApp 20 looks
pretty heavy for a quad core machine, but it really depends on your
sites and their relative traffic. Keep in mind that your server can
only do four things at once. Having thirty hungry processes is
actually going to cause more problems than only eight. I'd look at how
many Rack processes are running when you have problems and set
MaxPoolSize below that. You might need a couple of iterations or some
load testing as Ali suggested to find the right numbers.

Ramin
Reply all
Reply to author
Forward
0 new messages