Due to fluctuations in startup times for instances in AWS, it was speculated that allocation of EBS volumes may be the reason for the nondeterministic behavior. This led to an interesting discussion and finally to a small test to determine how volume size of an EBS volume allocated with an instance affect its startup time.
To gather some results the following script was created: https://s3-us-west-2.amazonaws.com/blog.xi-group.com/aws-ebs-allocation-times/aws-single.sh. It will create one instance of the specified type with N GB of Root EBS volume, wait for the instance to properly start and then terminate it. The time for the whole process is measured (e.g. full ‘time-to-service’).
The script was run multiple times for each instance type and EBS volume size. Results are presented in the following table:
t1.micro | c1.xlarge | m3.xlarge | m3.2xlarge | m2.4xlarge | |
---|---|---|---|---|---|
20 GB | ~ 1m 50s | ~ 1m 45s | ~ 1m 50s | ~ 2m 15s | ~ 3m 20s |
50 GB | ~ 2m 45s | ~ 2m 40s | ~ 2m 50s | ~ 2m 40s | ~ 3m 10s |
100 GB | ~ 3m 45s | ~ 3m 30s | ~ 3m 30s | ~ 4m 20s | ~ 5m 00s |
200 GB | ~ 6m 00s | ~ 6m 10s | ~ 9m 00s | ~ 5m 45s | ~ 7m 30s |
As shown, instance start time grows linearly with the size of the EBS Root volume. Moral of the story:
NOTE: The whole procedure is reasonably time consuming if you gather multiple data points (in this case, for each instance type / volume size the script was run 3 times and the average value is shown). It will cost money, since all EC2 allocations will be charged for at least an hour. The script, provided here is ‘AS IS’ and can be used as reference. Be sure to understand it and properly modify it before running it!
Related Posts
- Small Tip: How to use AWS CLI ‘–filter’ parameter
- Small Tip: How to use –block-device-mappings to manage instance volumes with AWS CLI
- Small Tip: How to use AWS CLI to start Spot instances with UserData
- How to deploy single-node Hadoop setup in AWS
- UserData Template for Ubuntu 14.04 EC2 Instances in AWS