title: Disk latency causing CPU spikes on EC2 instance
body: <p>We are having an interesting issue where we are seeing a CPU spike on our EC2 instance and at the same time we are seeing a spike in disk latency. Here is the pattern for CPU spike</p>
  
  <ol>
  <li>CPU spike from 50% to 100% within 30 seconds </li>
  <li>It stays at 100% utilization for two minutes</li>
  <li>CPU utilization is dropped from 100 to almost 0 in 10 seconds. At the same time almost disk latency is also back to normal</li>
  </ol>
  
  <p>This issue has happened on different AWS ec2 instances a couple of times over a week and still happening. In all cases we are seeing CPU spike along with disk latency with CPU spike having a similar pattern as above.</p>
  
  <p>We had put process monitoring tools to check if any particular process was occupying the CPU. That tool revealed that each of process on the ec2 instance starts taking approx twice the CPU. For eg our app server CPU utilization increases from .75% to 1.5 . Similar observation for Nginx and other processes. There was no single process occupying more than 8% CPU. We studied our traffic pattern and there is nothing unusual which can cause this. So the question is</p>
  
  <ol>
  <li>Can increase in disk latency cause the CPU spike pattern as above or in general can disk latency result in CPU spike</li>
  </ol>