AWS EBS GP2 Volume Bursting using fio
As you may aware there are four EBS volume types available in AWS.
- General Purpose SSD (GP2)
- Provisioned IOPS SSD (IO1)
- Throughput Optimized HDD (ST1)
- Cold HDD (SC1)
Each of these volume types has its own Strengths and Weaknesses. Out of four volume types described, GP2 and IO1 are more catered to IOPS sensitive workloads. If you again compare GP2 and IO1, Provisioned IOPS (IO1) is more seasoned for IOPS workloads and more powerful out of the two.
But we have to choose GP2 here, if we are going to test Burst Balance feature in this blog. This is mainly because Burst Balance feature is not available in IO1 and only available with GP2.
GP2 Volume Types
GP2 Volumes have the following key features:
Volume Size: 1 GB to 16TB (16,384 GB)
Min IOPS/Volume: 100 (but bur-stable to 3000)
Max IOPS/Volume: 16,000
Number of IOPS per GB: 3
If your EBS GP2 Volume storage is configured as 8GB in this example, the volume IOPS can be calculated as just 24 (3 * 8 GB).
Though the calculation refers as 24, the minimum IOPS for a GP2 is 100 (See above default settings). However, with EBS GP2 bursting feature, GP2 volumes can be burst up to 3000 IOPS (3 * 1000 GB) if required, without increasing the size of the volume (that is 8GB here). This is a really cool feature, which can handle sudden unpredictable EC2 workloads.
Burst Balance
However, this feature is provided to each EBS GP2 volume as a point system, which is known as Burst Balance. Whenever you consume the EBS GP2 volume, you are basically consuming your earned Burst Balance points automatically. Whenever you are not utilizing them, the system tends to regain your points back to the usual 100% mark again allowing you to use it for another spike(See Figure 1).
Using “fio” to Load the instance
The fio library [1] is a popular load test library, which is heavily used in Linux/ Unix environments. Since we consider an Amazon Linux as our EC2 AMI, we are able to leverage the same library for our load testing as well.
With this tool, you can configure the Read and Write (RW) loads in such a way to suit our requirement.
Steps
Lets try this and see now.
Step 1: Create an EC2 instance (Amazon Linux as OS) with an EBS volume (GP2) as the ROOT volume.
Step 2: Go to Volumes and select the Root Volume of the created EC2 instance.
Click the Monitoring tab and you will get to see a set of graphs (See Figure 1) with various monitoring metrics. The Burst Balance metric is one of them. This metric shows you the current Burst Balance utilization of the selected EBS volume (See Figure 2).
Step 3: SSH into EC2 instance and install fio now.
$ sudo yum install fio
Step 4: Lets add some load into EC2 instance using fio by executing the following command.
$ fio — randrepeat=1 — ioengine=libaio — direct=1 — gtod_reduce=1 — name=test — filename=random_read_write.fio — bs=4k — iodepth=64 — size=4G — readwrite=randrw — rwmixread=75
The above will create a 4GB file, and perform 4KB reads and writes using three reads for every write ratio (75%/25%), as specified with option — rwmixread=75), split within the file, with 64 operations running at a time.
The RW ratio can be adjusted for simulating various usage scenarios.
The final results are as follows.
Step 5: Now it is the time to go and check the Burst Balance in the Monitoring tab.
You can clearly see a dip in the graph after running the above test load. However, the Burst Balance can be regained with the time to give more opportunities for future executions (See Figure 7). This is a really cool feature added to EC2 EBS volumes.
References
- Linux/ Unix fio library — https://fio.readthedocs.io/en/latest/fio_doc.html
- Benchmarking EBS Volumes: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/benchmark_procedures.html
- How to test Disk Performance with fio and IOPing: https://www.unixmen.com/how-to-measure-disk-performance-with-fio-and-ioping/