Amit Kumar
Amit Kumar

Reputation: 905

How to scale aws ec2 cluster based on java application memory

I have a java application which is deployed on aws ec2 cluster. I have auto scaling configured based on cpu usage but the problem is application is not CPU intensive but is IO intensive, CPU usage is 20% on an average, so when traffic increases it is not able to send all the messages in real time causing buffering. This is causing delay in arrival of messages in downstream systems.

How can i auto scale my cluster based on incoming traffic and heap usage of deployed application?

Upvotes: 1

Views: 1550

Answers (2)

strongjz
strongjz

Reputation: 4491

You can create a bash script, running with cron, that collect the Java heap memory usage and incoming connections, and then sends the to cloudwatch custom metrics.

How to collect to memory and disk stats from AWS ec2 instances

Examples in Perl

And then Alert and Auto scale based on those custom metrics

Upvotes: 0

Ruslan Neruka
Ruslan Neruka

Reputation: 473

you should use custom metrics for this purposes CloudWatch does not collect memory consumption by default. To enable this you should use custom metrics script and then you be able to change autoscaling group behavior corresponding to memory consumption chages or any other event which you need to monitor and react

Upvotes: 2

Related Questions