title: Performance - How To Debug Slow Ubuntu Apache/PHP/MySQL Server
body: <p>I run an Apache/PHP/MySQL webserver running on Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-48-generic x86_64) with 4gb of RAM.</p>
  
  <p>Over the last few days, as load on the server has increased (100-200 requests per second), it seems to have stopped serving pages altogether. Here are some performance stats:</p>
  
  <ul>
  <li>Incoming network I/O: 2mb/s</li>
  <li>Outgoing network I/O: 11mb/s</li>
  <li>Memory (RAM) in use: 1.1gb</li>
  <li>CPU usage: 2%</li>
  </ul>
  
  <p>Here are the values in <code>mpm_prefork.conf</code>:</p>
  
  <pre><code>&lt;IfModule mpm_prefork_module&gt;
      StartServers              5
      MinSpareServers           5
      MaxSpareServers           50
      MaxRequestWorkers         150
      MaxConnectionsPerChild    5000
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>The requests occur on pages which typically have one database query and return data formatted in JSON. It is not graphical/database/resource intensive.</p>
  
  <p>Restarting the webserver will allow it to serve pages for around 1 minute, until load picks up and it returns to a frozen state.</p>
  
  <p>What can I look for or change to resolve this?</p>