dergachev / vagrant_drupal

Deploy a local Drupal development stack with Vagrant.
9 stars 2 forks source link

Apache Memory Usage #9

Open pixelite opened 11 years ago

pixelite commented 11 years ago

Currently, the 512MB RAM allotted to the VM caused the server to start swapping when Drupal is running. Need to adjust the apache config settings to account for this.

Could also add Nginx to the recipe to ensure that Apache isn't serving static files.

chef.json.merge!({
  #Settings to handle the 512MB of RAM that we have for the VM
  :apache => {
    :prefork => {
      :startservers => 4,
      :minspareservers => 5,
      :maxspareservers => 10,
      :serverlimit => 10,
      :maxclients => 10,
      :maxrequestsperchild => 999
    }
  }
}
pixelite commented 11 years ago

Note: we figured it might be a memory problem by doing the following (inside the VM!):

ab -n 5 http://localhost/node/56/abstracts # takes 5 seconds per page
top -d 1 # kswapd is running when drupal is loading
free -m # only a few megs free
ps aux  | egrep 'USER|apache2'  # 20+ of apache processes with 50-110MB of RAM (RSS column)

After adjusting the Vagrantfile as per above and running vagrant provision, we noticed the following:

ab -n 5 http://localhost/node/56/abstracts # takes 350ms per page (awesome)
top -d 1 # kswapd is still running when drupal is loading, but now only briefly
free -m # still only a few megs free, and swap is being used
ps aux  | egrep 'USER|apache2'  # 10+1 apache processes with 50-110MB of RAM (RSS column)

So we're still swapping, although it's not a big problem. If it becomes an issue, we can lower the settings more, or raise the RAM of the VM to 1GB.