These forums are read-only!
How I manage resource usage on Slices (for LAMP setups)
  • Deciding how much Slice you need is a bit tricky and really a job for a sysadmin and can be worked out by trial and error.

    In most cases the first bottle neck to be hit is memory consumption.

    Personally what I do for my sites is:

    1. Set up realtime monitoring for network throughput, disk IO rates, memory consumption and cpu usage. I open an ssh connection window for each and run these commands respectively, one in each window:

      watch free -m # For memory usage
      iostat 5 # For disk IO rates
      top # For cpu info
      top # then hit shift+m to organize processes by memory usage
      bwm-ng # Then hit: tttu to show average Kb/s to see if you're getting close to your bandwidth limits
    2. Once that's all set up .. I hit the site a little with: ab -c 2 -n 50 then keep an eye on the resource usages. Usually in the top with shift+m the largest apache proc will grow some what. Then I perform this calculation:

      MaxClients setting = (100 - mysql's memory usage (in percent)) / (the size of the largest apache process).

      Then in the Apache config (location depends on the linux distro), in the prefork section I set:

      <IfModule mpm_prefork_module>
          StartServers         10 
          MinSpareServers      10
          MaxSpareServers      10
          MaxClients           10
          MaxRequestsPerChild  1000

      Where '10' is the number I got from that calculation. (If I resize the Slice later, I'll re-run the calculation).

    3. After restarting Apache then, I'll run a more intense test using siege: You need to grab a bunch of links into your site and put them in a text flie. Then hit it as hard as you can and keep an eye on the resource usage. The site should not fall over. Then compare the 'requests per second' that siege is getting to what your users need.

    This works for the most common apache+mysql (LAMP) style setups.