Hydrator: Making EBS snapshot restoration faster through prewarming
Source code (GitHub) Original article on Medium (this article has modifications)
Making EBS Snapshot Restoration Faster Through Prewarming
By Muthu Palaniyappan Olagappan · 5 min read
Executive Summary
Restoring an Amazon Elastic Block Store (EBS) volume from a snapshot does not necessarily mean every block will be ready when an application first accesses it. Depending on the volume and its initialization state, early filesystem operations and file reads can incur additional latency as data is made available.
Consider restoring an Appian environment from a snapshot. When services start and begin accessing files on the restored volume, these initial operations can take longer than expected, delaying environment readiness. In our investigation, we explored whether we could reduce this overhead by preparing the filesystem metadata and file data the application needs, rather than always reading an entire volume.
This led us to Hydrator, an approach that combines filesystem scanning and targeted file prewarming. Using this approach, we reduced our Appian Engine startup time on a cold EBS volume from up to 90 minutes down to 10 minutes for customer sites with large volumes (>40GB) of engine data. This Hydrator method is 8x faster than the AWS suggested method.
Understanding the Cold EBS Problem
To understand the problem, we need to look at two distinct sources of delay.
- Unresponsive file system on cold EBS. When I ran
ls -alon a freshly started EBS volume, it took 6m 38s. Rerunning the same command took 11.4s. The first run took that long because it had to restore inode information for all files from S3 and store it in local EBS blocks, and it restored them sequentially, one block at a time. Each S3 read IO call takes 100ms. This means a script that lists files in a folder on a cold volume can take a long time. - Slow reads of large files on cold EBS. The file and the file system are restored from S3 block by block. If a program scans large files, it can take a long time to scan the whole file.
Solutions Offered by AWS
- Using
dd/fioto read the entire volume. Prewarming the entire disk is inefficient just to start some apps on cold EBS. Many apps only need some files to be warm to start faster. - Fast Snapshot Restore (FSR). AWS can provide a fully hot EBS volume snapshot using FSR, but it takes 1 hour per TiB of snapshot to become FSR ready. We could not afford to wait that long.
- Faster volume initialization rate. AWS can initialize an EBS volume faster by raising the initialization rate from 100 MiB/s to 300 MiB/s, but this does not guarantee that the files you need are initialized first.
Since the above methods did not help Appian, we developed the Hydrator CLI.
Basics: Understanding the Limits of EBS

Only four variables control EBS and its behavior:
- Volume type (io2 or gp3).
- IOPS (gp3: 3,000–80,000).
- Throughput (125 MB/s–2,000 MB/s).
- Initialization rate (100 MiB/s–300 MiB/s).
IOPS is the number of I/O calls executed in one second. Throughput is the amount of data you can read from EBS. io2 is the costly volume type and gp3 is the cheaper one. We should maximize the use of the variables we can control.
How to Prewarm a Cold File System on EBS
The solution is to use fd. fd is a multi-threaded find, so it can scan all the required directories quickly. Once the directory entries are looked up, subsequent reads are faster. If a script does not work well with a cold file system, run this command to maximize IOPS and keep the file system you care about warm:
fd --threads 64 --full-path /path/to/pre-warm
Why do we need to scan in parallel? The XFS file system stores metadata in multiple disk blocks scattered across the disk. When we run ls, we must scan this metadata across many blocks. Each block read takes 100ms for AWS to load from S3. The way XFS stores data, combined with AWS restoring block data lazily from S3, is what makes a simple operation like ls take 60 seconds.
Would fd solve all the problems? If all the files live in a single directory, scanning the directory entries cannot be parallelized, so prewarming takes longer. Split the files into multiple directories so they can be scanned in parallel.

How to Prewarm a Cold File on EBS
We ran latency experiments that measured reading a large file sequentially in 2 KB chunks. We found that when we request 2 KB of data, AWS restores 512 KB from S3. We can use this 2 KB to 512 KB ratio to issue many parallel I/O calls, maximize IOPS, and reduce the throughput bottleneck. The core idea is one 2 KB read per 512 KB block, issued in parallel. Previously, with dd/fio, we could prewarm a 60 GB file in 25 minutes. With this technique, we prewarmed it in 8 minutes.

With default gp3 storage we could run 3,000 IO operations per second, and each I/O call could prewarm 512 KB. With a 125 MB/s throughput limit, we could force EBS to prewarm the disk at its full 125 MB/s. This method worked better than AWS’s suggested methods because it prewarms only the files needed to start the site faster, instead of the entire volume.
Idea: Why Warm Entire Files When Partial Initialization Is Enough?
Sometimes a service does not need the whole file warm to start. For example, MySQL reads only some header details and does not parse the whole file, so we prewarm just the first few bytes to start faster.
Results
| Method | Command | Time for file prewarming | Notes |
|---|---|---|---|
| AWS recommended method (full volume initialization) | fio --filename=/dev/ | 7 hrs (whole disk) | Inefficiently tries to prewarm the whole file system |
| AWS method with modification (selective file prewarming using default fio) | fio --filename=/path/to/your/file.dat --rw=read --bs=128k --iodepth=32 --ioengine=libaio --direct=1 --name=volume-initialize | 12m 19s (12 GB file, 1 engine file) | Reads the whole selected files and does not maximize IOPS utilization. Many times we could avoid prewarming the whole disk. |
| Appian's strided block read (fio) | fio --name=skip-read --filename="$FILE" --rw=read --bs=2k --zonemode=strided --zonesize=2k --zoneskip=510k --number_ios=$N --direct=1 --ioengine=libaio --iodepth=$D --iodepth_batch_submit=$D --iodepth_batch_complete_min=1 | 1m 38s (12 GB file, 1 engine file) | Maximizes IOPS utilization by reading the first 2 KB of each 512 KB block |
| Appian's optimized Hydrator CLI tool | Hydrator CLI (internal tool) | 1m 33s (12 GB file, 1 engine file) | Prewarms both files and file systems as a single CLI tool |
Using the prewarming method above, we reduced Appian Engine startup on cold EBS volumes (60 GB across multiple engine files) from 90 minutes to 10 minutes. This Hydrator method is 8x faster than the AWS suggested method. Prewarming the file system metadata also improved scan speeds across the file system.
We recommend using Appian’s Hydrator CLI, or running fio alongside fd with the right configuration, to prewarm both files and the file system. That mitigates cold EBS volume latency.
The Hydrator CLI code is at appian/tech-blog-examples: hydrator-cli.
Share this post