Elastic Beanstalk Multiple Instances for Java Application Performance Improvement

Using Multiple Instances for Elastic Beanstalk Environment

Prev Question Next Question

Question

Elastic Beanstalk environment has been used for your team recently for a feature development based on Java.

When the team firstly created the environment, they were using a single instance as they did not consider the capacity.

However, after a while you find that the application needs to consume more memory and CPU than being expected sometimes during traffic spike.

As a result, the application has some performance issues.

Your AWS solution architect suggests you use multiple instances rather than one.

What should you do?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Option C is Correct:

In AWS Elastic Beanstalk, you can create a load-balancing, autoscaling environment or a single-instance environment.

The type of environment that you require depends on the application that you deploy.

For example, you can develop and test an application in a single-instance environment to save costs and then upgrade that environment to a load-balancing, autoscaling environment when the application is ready for production.

For more information, refer to.

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-types.html

To use Amazon EC2 Auto Scaling effectively, configure triggers that are appropriate for your application, instance type, and service requirements.

You can scale based on several statistics including latency, disk I/O, CPU utilization, and request count.

Refer to.

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-autoscaling-triggers.html

for the Elastic Beanstalk AutoScaling triggers.

Option A is incorrect because MemoryUtilization is NOT a scaling trigger for Elastic Beanstalk multi instances environment.

The valid triggers include CPUUtilization, NetworkIn, Latency, DiskReadOps, etc.

Option B is incorrect because you do not need to destroy this existing one to change the environment type.

Option D is incorrect because the valid statistics for scaling trigger are Max, Mim, Sum and average.

Median is not a valid one.

Refer to the below:

Option E is incorrect: because you are unsure if t2.large instance type is able to meet the need.

Also the traffic is not stable so that a higher capacity instance type is not cost effective.

The best solution is to use the auto scaling environment that Elastic Beanstalk provides.

Scaling triggers

Metric

Statistic

Unit

Period

Breach duration

CPUUtilization *
Minimum
Maximum

sum
v Average i]

Choose how the metric is interpreted.

© determine if the environments capacity is too low or too high.

Bytes

5 Min

‘The period between metric evaluations.

5 Min

‘The amount of time a metric can exceed a threshold before triggering a scaling operation.

The correct answer to this question is option C. Modify the environment's capacity settings to a load balanced environment type with autoscaling. Select all availability zones. Also add a scaling trigger if average CPUUtilization is over 85% for a 5-minute period.

Explanation:

Elastic Beanstalk is a fully managed service provided by AWS that makes it easy to deploy, manage, and scale web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker. Elastic Beanstalk automatically scales and load balances the application across multiple instances, providing high availability and fault tolerance.

In this scenario, the application is experiencing performance issues due to the high CPU and memory usage during traffic spikes. To resolve this issue, the environment needs to be scaled horizontally by adding more instances.

Option A suggests changing the environment type to a high available environment by editing the environment's configuration and adding multiple instances with autoscaling based on MemoryUtilization. This option is partially correct as it addresses the need for adding multiple instances but does not include autoscaling based on CPU utilization, which is a more critical metric to consider for scaling.

Option B suggests destroying the environment and creating a new environment with multiple instances, which is not necessary and will result in downtime for the application.

Option D suggests editing the environment's capacity configuration to a load balanced environment type and adding a scaling event when the median CPU utilization is over 85% for a period of 1 minute. This option is also partially correct as it includes autoscaling based on CPU utilization but does not consider memory utilization, which can also affect the application's performance.

Option E suggests modifying the instance type to t2.large to meet the need for high CPU and memory. While this can be a temporary solution, it does not address the need for horizontal scaling to handle traffic spikes.

Option C is the most appropriate solution as it modifies the environment's capacity settings to a load balanced environment type with autoscaling based on both CPU and memory utilization. It also selects all availability zones and adds a scaling trigger if the average CPU utilization is over 85% for a 5-minute period, ensuring that the environment can handle traffic spikes while maintaining optimal performance.

In summary, when scaling Elastic Beanstalk environments, it is important to consider both CPU and memory utilization, select all availability zones, and set appropriate scaling triggers to ensure high availability and optimal performance during traffic spikes.