Skip to content

Instantly share code, notes, and snippets.

@mlconnor
Created January 9, 2014 21:51
Show Gist options
  • Select an option

  • Save mlconnor/8342725 to your computer and use it in GitHub Desktop.

Select an option

Save mlconnor/8342725 to your computer and use it in GitHub Desktop.
Apache Tomcat Memory Settings for Elastic Beanstalk
My findings….
The Apache Web Server footprint will basically be
Apache Web Server Footprint = MaxClients * (Max Memory per Child)
Ryan found our current Apache settings for EB to be…
ServerLimit 256
MaxClients 256
This is the base memory I'm seeing on Apache when things are quiet. Yes, this is a sweet bash one liner!!!!!!!!!!!!!!!!!
ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print "Average Proccess Size (MB): "x/((y-1)*1024)}'
Apache Memory Usage (MB): 23.0117
Average Proccess Size (MB): 2.55686
So if the child processes are at 3M (which I think they would be in a Tomcat type environment) then we would have about 750M for Apache Web Server when it's under load at 256 workers.
A small Amazon instance seems to need about 300M – 400M of memory for the OS. See below
top - 21:39:45 up 1:02, 1 user, load average: 0.00, 0.01, 0.05
Tasks: 57 total, 1 running, 56 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1696516k total, 299948k used, 1396568k free, 9796k buffers
Swap: 917500k total, 0k used, 917500k free, 232616k cached
SMALL INSTANCES
1.7G (system memory) - 400M (system memory) - 750M (apache memory) = 550M for Tomcat and other
RECOMMENDATION IS 200M for MX and 500 for MS.
MEDIUM INSTANCES
3.75G (system memory) - 400M (system memory) - 750M (apache memory) = 2600M for Tomcat and other.
RECOMMENDATION IS 200M for MX and 2G for MS.
DECISION POINT
If we do performance testing in TEST then I recommend we make those servers match up to PROD exactly. The autoscaling settings (min servers, max servers) should enable us to control costs in TEST. Thoughts????
Apache Default settings in EB
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment