- Newest
- Most votes
- Most comments
The "re:Post Agent" answer is pretty good, definitely read through that. A few more points to call out in addition to what it mentioned though:
-
In addition to picking the right metric for your application (many users swap from NetworkOut to CPU), make sure the target value is correct. If its set too high, then the instances will end up getting overloaded and going unhealthy before a scale-out is triggered
-
Make sure the load test doesn't instantly go to the max requests the load generator can handle, otherwise the environment will get overloaded before AutoScaling can react to the increase. Scaling policies are reactive, and they only trigger after load has gone up and the CloudWatch alarm triggers. Either gradually increase load over the test, or pick a realistic amount to spike to over a short time to simulate a sudden rush of users (if this is an expected pattern for the application)
To test scaling of an AWS Elastic Beanstalk environment, you can follow these steps:
-
First, ensure that your environment is configured for load balancing and auto scaling. You can do this by setting the Environment type to "Load balanced" in the Elastic Beanstalk console under the Configuration > Capacity section.
-
Configure appropriate Auto Scaling triggers based on metrics that are relevant to your application. Common metrics for benchmarking and scaling include:
- NetworkOut (default)
- CPUUtilization
- RequestCount
- TargetResponseTime
-
Set appropriate minimum and maximum instance counts. For example, you could set a minimum of 2 instances and a maximum of 4 instances.
-
Use a load testing tool to simulate high traffic or workload on your application. This is crucial for properly evaluating performance and triggering auto scaling.
-
Monitor your environment closely during the load test. You can use the Elastic Beanstalk console, CloudWatch, or other monitoring tools to observe when new instances are launched.
If you're not seeing new instances start up despite generating a lot of requests, it's possible that:
- Your scaling triggers are not configured correctly
- The thresholds for scaling are set too high
- The breach duration (the time a metric must exceed a threshold before scaling occurs) is too long
To address this, review and adjust your Auto Scaling trigger settings. You may need to lower the thresholds or adjust the breach duration to make the environment more responsive to increased load.
Remember, simply changing the instance health status to warning doesn't necessarily trigger scaling. The actual metrics you've configured for scaling (like CPU utilization or request count) need to exceed the defined thresholds for the specified duration to initiate scaling actions.
If you want to force the environment to start a new instance for testing purposes, you can manually increase the minimum number of instances in your Auto Scaling group configuration. This will cause Elastic Beanstalk to immediately launch new instances to meet the new minimum requirement.
Sources
Benchmark and scale an application in AWS Elastic Beanstalk | AWS re:Post
Auto Scaling triggers - AWS Elastic Beanstalk
Auto Scaling group for your Elastic Beanstalk environment - AWS Elastic Beanstalk
Configure your Elastic Beanstalk environment - AWS Elastic Beanstalk
Relevant content
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 months ago
