3

Our client has a Ruby on Rails app that is mostly client-based (i.e, very little processing in controllers and views), with Apache and Passenger in the server stack.

We see each connection takes about 2MB per user connection. Is this reasonable, or did we do something wrong in the configuration?

We're trying to estimate how many users each server can support.

Thanks!

Crashalot
  • 177
  • 3
  • 11

3 Answers3

2

The memory footprint for phusion passenger should be determined using passenger-memory-stats. See http://www.modrails.com/documentation/Users%20guide%20Apache.html#_inspecting_memory_usage

I would note the following comment about RSS field:

The Private or private dirty RSS field shows the real memory usage of processes. Here, we see that all the Apache worker processes only take less than 1 MB memory each. This is a lot less than the 50 MB-ish memory usage as shown in the VMSize column (which is what a lot of people think is the real memory usage, but is actually not).

They provided a good example on memory output:

[bash@localhost root]# passenger-memory-stats
------------- Apache processes --------------.
PID    PPID  Threads  VMSize   Private  Name
---------------------------------------------.
5947   1     9        90.6 MB  0.5 MB   /usr/sbin/apache2 -k start
5948   5947  1        18.9 MB  0.7 MB   /usr/sbin/fcgi-pm -k start
6029   5947  1        42.7 MB  0.5 MB   /usr/sbin/apache2 -k start
6030   5947  1        42.7 MB  0.5 MB   /usr/sbin/apache2 -k start
6031   5947  1        42.5 MB  0.3 MB   /usr/sbin/apache2 -k start
6033   5947  1        42.5 MB  0.4 MB   /usr/sbin/apache2 -k start
6034   5947  1        50.5 MB  0.4 MB   /usr/sbin/apache2 -k start
23482  5947  1        82.6 MB  0.4 MB   /usr/sbin/apache2 -k start
### Processes: 8
### Total private dirty RSS: 3.50 MB

--------- Passenger processes ---------.
PID    Threads  VMSize   Private  Name
---------------------------------------.
6026   1        10.9 MB  4.7 MB   Passenger spawn server
23481  1        26.7 MB  3.0 MB   Passenger FrameworkSpawner: 2.0.2
23791  1        26.8 MB  2.9 MB   Passenger ApplicationSpawner: /var/www/projects/app1-foobar
23793  1        26.9 MB  17.1 MB  Rails: /var/www/projects/app1-foobar
### Processes: 4
### Total private dirty RSS: 27.76 M
Nan Liu
  • 514
  • 2
  • 4
0

I have a similar question waiting for answer. I used the following command,

ps aux | grep "apache"
apache   10120  0.1  5.2 287908 31964 ?        S    10:41   0:26 /usr/sbin/httpd

5.2% of total memory (600MB), so around 3MB per process (using php). Not sure if this is correct.

My question is here, ec2 memory usage

Adam C.
  • 193
  • 1
  • 9
0

2MB is reasonable for Apache depending on what modules you're utilizing. To look into maximizing memory efficiency you might want to look into Apache's mpm_worker module

thinice
  • 4,716
  • 21
  • 38