Optimizing disk on AWS


Optimizing Disk Performance

Because of the way that Amazon EC2 virtualizes disks, the first write to any location on an instance store volume performs more slowly than subsequent writes. For most applications, amortizing this cost over the lifetime of the instance is acceptable. However, if you require high disk performance, we recommend that you pre-warm your drives by writing once to every drive location before production use.

Note: The I2, R3, and HI1 instance types use direct-attached solid state drives that provide maximum performance at launch time, without pre-warming. If you require greater flexibility in latency or throughput, we recommend using Amazon EBS. To pre-warm the instance storage volumes, use the following Linux/Unix dd commands, depending on which store you want to initialize (/dev/sdb, etc.).

Note: Make sure to un-mount the drive before performing this command. Initialization can take a long time (about 8 hours for an extra large instance). To initialize the instance store volumes, use the following commands on the m1.large, m1.xlarge, c1.xlarge, m2.xlarge, m2.2xlarge, and m2.4xlarge instance types:

dd if=/dev/zero of=/dev/sdb bs=1M
dd if=/dev/zero of=/dev/sdc bs=1M
dd if=/dev/zero of=/dev/sdd bs=1M
dd if=/dev/zero of=/dev/sde bs=1M

For information about the instance storage that is available for each instance type, see Instance Stores Available on Instance Types. To perform initialization on all instance store volumes at the same time, use the following command: dd if=/dev/zero bs=1M|tee /dev/sdb|tee /dev/sdc|tee /dev/sde > /dev/sdd Configuring drives for RAID initializes them by writing to every drive location. When configuring software-based RAID, make sure to change the minimum reconstruction speed:

echo $((30*1024)) > /proc/sys/dev/raid/speed_limit_min

Reference URL: