Introduction: Recently I have conducted a quick lab on Amazon Cloud for Web Applications Engineering students at AIT. We launch different type of EC2 instances supporting 32-bit OS and installed a simple Web application. Then we benchmark the performance of the EC2 instances for the sample Web application. I am documenting the details of the lab so anyone can reproduce it.
Groups and Type of EC2 Instances : We divided students into four groups, each group launched a different type of EC2 instances. The group name and the type of EC2 instance launched are as follows:
- Group1: EC2 micro instance
- Group2: EC2 small instance
- Group3: Ec2 medium instance (m1.medium)
- Group4: Ec2 medium instance (c1.medium)
Note: You can read the specification of these instances at http://aws.amazon.com/ec2/instance-types/.
Sample Web Application: All four groups launched instances based on a private AMI that have already installed Apache web server, PHP, and a sample web application containing two pages; index.php and quad.php . The index.php page just provides a link to the quad.php that solve quadratic equation by generating random values for a, b, and c. (See the bottom of the post to download the source code for both of the page).
Workload Generation: We used httpef to generate synthetic workload for the application in increasing step-up fashion. In simple words, over the time we keep increasing the number of user sessions to the application. Each user session makes a request to the index.php and then wait for few seconds and makes a request to quad.php. (The workload generation script db.sh, urls.txt, httperf_script.sh are also available in the lab material, see the bottom of the post. You need to fix server parameter in httperf_script.sh to the public DNS name of your instance and run db.sh script.)
Results: The following four graphs show the average response time during the experiment for each type of the instances.
EC2 micro instance performance
EC2 small instance performance
EC2 m1.medium instance performance
EC2 c1.medium instance performance
We have seen the performance of the different type of instances varies for the same application and workload. Medium instances (c1.medium and m1.medium) are very consistent in the performance. Once we see a dramatic growth in the response time then we never observe any decrease in the response time for the Medium instances. However Small instance is not as consistent as Medium instances. Micro instance performance is quite interesting. It fluctuates over the time. The main reason for the micro instance performance inconsistency is mainly due to a special CPU allocation strategy by Amazon. More detail about the Micro instance CPU scheduling is available at http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/concepts_micro_instances.html.
Conclusion: Different type of EC2 instances are available to host the Web applications however we need to identify the most appropriate that helps to reduce the cost and maintain a good performance for the application. The lab provides a hands-on experience to use EC2 instances and benchmark the applications hosted on Amazon EC2 instances.
Download Lab Material (httperf scripts and sample Web application)