Amazon Elastic Compute Cloud
User Guide (API Version 2013-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Increasing EBS Performance

After you have learned the basics of working with EBS volumes, it's a good idea to look at the I/O performance you require and your options for increasing EBS performance to meet those requirements.

Maximize EBS Volume Performance

To ensure the best performance from your EBS volumes:

  • Use striping for multiple volumes

  • Maintain the recommended average queue length

  • Read or write to all blocks on the volume before it is first used

Striping Options for EBS Volumes

You can use RAID 0 or RAID 1+0 (RAID 10).

The following table compares these striping options.

ConfigurationUseAdvantagesDisadvantages

RAID 0

When I/O performance is more important than fault tolerance, such as a heavily used database (where data replication is already set up separately).

I/O is distributed across the volumes in a stripe. If you add a volume, you get the straight addition of throughput.

Performance of the stripe is limited to the worst performing volume in the set.

RAID 1+0 (RAID 10)

When fault tolerance is more important than I/O performance, such as a critical application.

Safer from the standpoint of data durability.

Doubles the amount of I/O required from the instance to EBS compared to RAID 0, because you're mirroring all writes to a pair of volumes, limiting how much you can stripe.

Average Queue Length

The queue length is the number of pending I/O requests. To benefit from Provisioned IOPS, a Provisioned IOPS volume must maintain an average queue length (rounded up to the nearest whole number) of 1 for every 200 provisioned IOPS in a minute. If you set the queue length to less than 1 per 200 IOPS provisioned, then your volume will not consistently deliver the IOPS that you've provisioned. Setting the queue length too far above the recommended setting won't affect the IOPS your volume delivers, however per-request latencies will increase. For a Provisioned IOPS volume of 500, the queue length average must be 3. If the average queue length is less than 3 for this volume, you aren't consistently sending enough I/O requests.

Prepare a New Volume

There is a 5 to 50 percent reduction in IOPS when you first access the data on a volume. Performance is restored after the data is accessed once. Therefore, we recommend that you read or write to all the blocks on your volume before you use it. For a completely new volume that was created from scratch, you should write to all blocks before using the volume. For a new volume created from a snapshot, you should read all the blocks that have data before using the volume.

In Linux, the following command reads from all blocks on a volume.

$ dd if=/dev/md0 of=/dev/null

Achieve Consistent Performance

To achieve consistent performance from your EBS volumes:

  • Use EBS-Optimized instances

  • Plan for snapshots

Use EBS-Optimized Instances

The following table provides examples of when you'd want to use an EBS-Optimized instance with each type of EBS volume.

EBS-Optimized instanceVolume typeRecommended use

Yes

Provisioned IOPS

Performance-sensitive production databases. Workloads with minimal variability and dedicated EBS traffic that requires high IOPS performance.

No

Provisioned IOPS

Not recommended, as Provisioned IOPS volumes are designed to deliver the expected performance only when attached to an EBS-Optimized instance.

Yes

Standard EBS

Scaling throughput from a number of volume stripes where I/O performance consistency isn't critical.

No

Standard EBS

Low-cost persistent storage for applications that are not performance sensitive, such as low transaction databases or log files. Also well suited for use as boot volumes.

You must use EBS-Optimized instances to get the full performance benefits of Amazon EBS Provisioned IOPS volumes. For more information, see EBS-Optimized Instances.

Plan for Snapshots

Frequent snapshots provide a higher level of data durability, but they also degrade the performance of your application while the snapshot is in progress. This trade off becomes critical when you have data that's changing rapidly.

To minimize the impact of snapshots on performance of a master node, create snapshots from a read replica of your data. Ideally, create these snapshots during off-peak usage.

Monitor IOPS Performance

Provisioned IOPS volumes deliver within 10 percent of the provisioned IOPS performance 99.9 percent of the time over a given year.

These are the key indicators of IOPS performance:

  • The total throughput

  • The average queue length

To ensure the consistency of Provisioned IOPS, an application must send a sufficient number of I/O requests. If an application does so, the EBS volume maintains a queue length that ensures IOPS performance. The volumes must maintain an average queue length of 1 (rounded up to the nearest whole number) for every 200 provisioned IOPS in a minute. For a Provisioned IOPS volume of 500 IOPS, the volume must maintain an average queue length of 3.

The following are possible reasons why a volume isn't meeting the performance threshold:

  • The application isn't sending a sufficient number of I/O requests.

  • The application is sending I/O requests that have a block size larger than 16 KB.

  • [Striped volumes] The application isn't sending I/O requests randomly and consistently across all volumes in the stripe set. Every volume in the stripe set must maintain the recommended average queue length.

  • Snapshots are being created frequently during peak usage.

Benchmark Provisioned IOPS Volumes

This section demonstrates how you can test the performance of Provisioned IOPS volumes by simulating workloads similar to those of a database application. The process is as follows:

  1. Launch an EBS-Optimized instance

  2. Create new Provisioned IOPS volumes

  3. Attach the volumes to your EBS-Optimized instance

  4. Create a RAID array from the volumes, then format and mount it

  5. Install a tool to benchmark I/O performance

  6. Benchmark the I/O performance of your volumes

  7. Delete your volumes and terminate your instance so that you don't continue to incur charges

Set Up Your Instance

To get optimal performance from a Provisioned IOPS volume, we recommend that you use an EBS-Optimized instance. EBS-Optimized instances deliver dedicated throughput between Amazon EC2 and Amazon EBS, with options between 500 and 2000 Mbps, depending on the instance type.

To create an EBS-Optimized instance, select Launch as an EBS-Optimized instance when launching the instance using the EC2 console, or specify --ebs-optimized when using the command line. Be sure that you launch one of the instance types that supports this option. For the example tests in this topic, we recommend that you launch an m1.xlarge instance. For more information, see EBS-Optimized Instances.

To create a Provisioned IOPS volume, select Provisioned IOPS (io1) when creating the volume using the EC2 console, or specify --type io1 --iopsiops when using the command line. For information about attaching these volumes to your instance, see Attaching a Volume to an Instance.

For the example tests, we recommend that you create a RAID array with 6 volumes, which offers a high level of performance. Because you are charged by the GB used and the number of provisioned IOPS, not the number of volumes, there is no additional cost for creating multiple, smaller volumes and using them to create a stripe set. If you're using Oracle ORION to benchmark your volumes, it can simulate striping the same way that Oracle ASM does, so we recommend that you let ORION do the striping. If you are using a different benchmarking tool, you'll need to stripe the volumes yourself.

For information about creating a striped volume on Windows, see Create a Striped Volume in Windows.

To create a six-volume stripe set on Linux, use a command like the following.

$ sudo mdadm --create /dev/md0 --level=0 --chunk=64 --raid-devices=6 /dev/sdf /dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk

For this example, the file system we use is XFS. You should use the file system that meets your requirements. On Amazon Linux, use the following command to install the XFS file system.

$ sudo yum install -y xfsprogs

Then, use the following commands to create and mount the XFS file system.

$ sudo mkdir -p /media/p_iops_vol0 && sudo mkfs.xfs /dev/md0 && 
sudo mount -t xfs /dev/md0 /media/p_iops_vol0 && sudo chown ec2-user:ec2-user /media/p_iops_vol0/

Finally, to get the most accurate results while running these tests, you must pre-warm the volume. For a completely new volume that was created from scratch, you should write to all blocks before using the volume. For a new volume created from a snapshot, you should read all the blocks that have data before using the volume. For example, on Linux you can read each block on the volume using the following command.

$ dd if=/dev/md0 of=/dev/null

On Windows, a full format of the volume pre-warms it. Use the format <drive letter> /p:1 command to write zeros to the entire disk.

Important

Unless you pre-warm the volume, you might see between a 5 to 50 percent reduction in IOPS when you first access it.

Install Benchmark Tools

The following are among the possible tools you can install and use to benchmark the performance of a Provisioned IOPS volume.

ToolPlatformDescription

fio

Linux, Windows

For benchmarking I/O performance. (Note that fio has a dependency on libaio-devel.)

Calibration with the Oracle Orion Calibration Tool

Linux, Windows

For calibrating the I/O performance of storage systems to be used with Oracle databases.

SQLIO

Windows

For calibrating the I/O performance of storage systems to be used with Microsoft SQL Server.

For information about how to improve the performance of your Microsoft SQL Server databases, see Optimizing Databases at the MSDN website.

Example Benchmarking Commands

These benchmarking tools support a wide variety of test parameters. You should use commands that approximate the workloads your volumes will support. These commands are intended as examples to help you get started.

Run the following commands on an EBS-Optimized instance with attached Provisioned IOPS volumes that have been pre-warmed.

When you are finished testing your volumes, see these topics for help cleaning up: Deleting an Amazon EBS Volume and Terminating Instances.

fio Commands

Run fio on the stripe set that you created.

By default, fio is installed in /usr/local/bin, which isn't in root's path. You should update your path, or use chmod to enable fio to be run as ec2-user.

The following command performs 16 KB random write operations.

fio --directory=/media/p_iops_vol0 
--name fio_test_file --direct=1 --rw=randwrite --bs=16k --size=1G 
--numjobs=16 --time_based --runtime=180 --group_reporting 

The following command performs 16 KB random read operations.

fio --directory=/media/p_iops_vol0 
--name fio_test_file --direct=1 --rw=randread --bs=16k --size=1G 
--numjobs=16 --time_based --runtime=180 --group_reporting 

For more information about interpreting the results, go to this Linux tutorial: Inspecting disk IO performance with fio.

Oracle ORION Commands

Run ORION on the Provisioned IOPS volumes, having it simulate Oracle ASM striping instead of providing it with a stripe set that uses Windows striping.

In the directory where you installed ORION, create a file, piops_test.lun, to specify the volumes for your stripe set. The following example file specifies six Provisioned IOPS volumes to be striped.

\\.\D:
\\.\E:
\\.\F:
\\.\G:
\\.\H:
\\.\I:

The following command performs 16 KB random I/O operations (80 percent reads and 20 percent writes), simulating 64 KB RAID-0 stripes.

orion -run advanced -testname piops_test -size_small 16 -size_large 16 
-type rand -simulate raid0 -stripe 64 -write 80 -matrix detailed -num_disks 6

After the command is finished, ORION generates output files with the results in the same directory. For more information about ORION, see its User Guide.

SQLIO Commands

Run SQLIO on the stripe set that you created.

Create a file, param.txt, to specify your striped set. The contents of this file should look something like this (here, d:\ corresponds to the striped set, and the test uses 6 threads and a 10 GB file).

d:\bigtestfile.dat 6 0x0 10240

The following command performs 16 KB random data writes.

sqlio -kW -s600 -frandom -t8 -o8 -b16 -LS -BH -Fparam.txt

The following command performs 16 KB random data reads.

sqlio -kR -s600 -frandom -t8 -o8 -b16 -LS -BH -Fparam.txt

The results are displayed in the Command Prompt window. For more information about SQLIO, see the readme.txt file in your SQLIO installation directory.