Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have an m1.medium EC2 instance with a small (15G) EBS drive, running both Rails 3 and a PostgreSQL server. We've noticed CPU spikes at odd times, and finally realized that even simple, sustained EBS access seems to pin the CPU. For instance, just grepping about 3G of logs resulted in 100% CPU usage - which means both cores, which should be impossible for grep! Deleting a bunch of log files also used about 25% of the CPU, which is more than I'd expect. We're not swapping.

Is this normal? It's hard to Google for this, since "high CPU" is also the name of a type of EC2 instance. I'll happily provide more details and benchmarks, but first I wanted to check if this was a thing.

share|improve this question
    
There is no m1.medium. Perhaps you mean m1.small or c1.medium? –  Eric Hammond Nov 15 '11 at 2:43
    
what does iostat -x 1 say while you are running the cpu intensive process. It sounds like you might just have high iowait time. –  Aaron Brown Nov 15 '11 at 2:45
1  
You're both right - it's c1.medium and yes, it's iowait, which IIUC is not "real" CPU. Thanks. –  Jay Levitt Nov 15 '11 at 13:17

2 Answers 2

up vote 6 down vote accepted

Performance of EBS volumes can be affected by things like:

  • New EBS volumes have a first-use penalty, even if they are created from an EBS snapshot. The first time you read or write to each block on the volume will take much longer than subsequent hits.

  • When an EBS snapshot has been initiated, the EBS volume may experience high iowait when you try to write to a block that has not yet been copied to the S3 snapshot storage.

  • EBS volumes use network bandwidth on the instance. You may get better IO performance and reduced CPU iowait if you upgrade to a larger instance type.

Here's an article I wrote about the lazy-load of EBS volumes from snapshots:

Identifying When a New EBS Volume Has Completed Initialization From an EBS Snapshot
http://alestic.com/2010/03/ebs-volume-initialization-from-snapshot

Here's an article I wrote describing why we had to move our EBS snapshots to a slave database instead of running them on the master:

EBS Snapshots of a MySQL Slave Database on EC2
http://alestic.com/2009/08/ec2-mysql-slave-snapshot

share|improve this answer

It's likely that nearly all of the CPU time spent during the grep you mention was due to iowait. Run top in another terminal during the grep and watch the %wa value. That value is the amount of time being spent waiting for IO to complete.

It's a well-known and well-discussed fact that EBS volumes perform quite poorly when it comes to IO. This is why many organizations will bond several EBS vols together via RAID (usually RAID 0, but possibly other levels may be useful as well) to increase performance.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.