4
votes

Is there any other way to prewarm the PIOPS EBS volume other than using following command?

sudo dd if=/dev/xvdf of=/dev/null bs=1M

Above command seems to take longer period of time as the size of EBS vol increase.

So In my case ideally, I want to create a volume using my snapshots and with minimum downtime I want to use that volume as my mysql data directory but before that I want to prewarm it. If there is a way to fast the process, that'd be great. However we are not challenged on hardware front we can take as bigger machine as required on AWS.

2
The time prewarm will take is directly in relation to the size of the volume. You need to read every single block. dd is probably the quickest way to do it. You can improve the performance of the EBS by adding more PIOPS, increase the size of the instance (better network) or using EBS optimize instances. You will have to test which one give you best performance. - Kazaag
Are you experiencing a problem that makes you want to pre-warm the volume? The time taken to pre-warm might ruin the benefit you obtain through pre-warming. - John Rotenstein
fio should be faster than dd as it's multi-threaded. - KJH

2 Answers

2
votes

You state that you "want to create a volume using my snapshots", so pre-warming by writing data is not a good idea. Instead, you should read the data, which will cause the data to be loaded from the snapshot onto your EBS volume.

From Pre-Warming Amazon EBS Volumes:

When you create any new EBS volume (General Purpose (SSD), Provisioned IOPS (SSD), or Magnetic) or restore a volume from a snapshot, the back-end storage blocks are allocated to you immediately. However, the first time you access a block of storage, it must be either wiped clean (for new volumes) or instantiated from its snapshot (for restored volumes) before you can access the block. This preliminary action takes time and can cause a 5 to 50 percent loss of IOPS for your volume the first time each block is accessed. For most applications, amortizing this cost over the lifetime of the volume is acceptable. Performance is restored after the data is accessed once.

However, you can avoid this performance hit in a production environment by writing to or reading from all of the blocks on your volume before you use it; this process is called pre-warming. Writing to all of the blocks on a volume is preferred, but that is not an option for volumes that were restored from a snapshot, because that would overwrite the restored data. 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.

Pre-warming disks (by reading or writing) can take a long time. The bigger the disk, the longer it takes. If possible, avoid pre-warming. Instead, just use it as normal. Worst case is that you will experience slightly slower access when each block is first accessed, which generally isn't a problem (unless you're performing speed tests).

0
votes

Unless you're talking about the initial access performance penalty when restoring from a snapshot, prewarming is no longer needed. See Initializing Amazon EBS Volumes.

In case that page goes away, here is the excerpt:

New EBS volumes receive their maximum performance the moment that they are available and do not require initialization (formerly known as pre-warming). However, storage blocks on volumes that were restored from snapshots must be initialized (pulled down from Amazon S3 and written to the volume) before you can access the block. This preliminary action takes time and can cause a significant increase in the latency of an I/O operation the first time each block is accessed. For most applications, amortizing this cost over the lifetime of the volume is acceptable. Performance is restored after the data is accessed once.