Experiments, Lessons Learned, Best Practices & Tutorials
In part 3 of the Autoscaling for LAMP on AWS series,
After setting up your application autoscaling, it’s important to load run the application in order to understand the minimum and maximum number of instances required for each application.
First, fire the load run. For this article we’ve used HP LoadRunner because it provides more detailed results than others, but there are also other load runner tools to choose from. Be sure to run the load from multiple IP addresses or else the ELB may not distribute it equally across all instances. HP LoadRunner helps you use multiple nodes in order to generate the load.
Update the Auto Scaling Group’s minimum and maximum instance counts.
For the this article, we’ve set the minimum and maximum instance counts at 2 and 8 respectively.
Now change your Auto Scaling Policies. A scaling policy specifies whether to scale the auto scaling group up or down, and by how much. Here we’ve chosen 2 instances for Scale Up and Scale Down policies. These policies automatically increase or decrease the instances according to your defined conditions in order to maintain performance and minimize cost.
Next, increase the load gradually with LoadRunner. Once the CPU reaches 75% of the instances, Autoscaling will trigger the scale up policy to launch 2 more instances.
Now decrease the load gradually and the CPU instances load should come down to less than 45%. Autoscaling will then trigger the scale down policy and delete the additional instances that were launched.
Consider a scenario in which a 2,000-concurrent-request count is reached during peak hours and 500 users are reached during non-peak hours. For best load run results, try the following.
Capture load test results and CloudWatch metrics for each of the following scenarios:
1. Start the load test with 500 users. Set the minimum instance count to 2 if you choose large or medium types, and set the maximum instance count to 4.
2. Increase the load to 1,000 users. Set the minimum and maximum instance counts to 2 and 6 respectively.
3. Increase the load to 2,000 users. Set the minimum and maximum instance counts to 4 and 10 respectively.
4. Increase the load to 3,000 users. Set the minimum and maximum instance counts to 6 and 12 respectively.
Analyze the results for each scenario and note which gives better throughput and response times. Also check the DB metrics.
Now it will be easy to choose the best instance type and max/min instance counts..
Update the autoscale group to resize the instance count to 0. This will terminate all instances launched within the lamp-asg autoscale group.
Watch out for the final part of this series tomorrow on how to choose an instance type.