阅读背景:

如何基于java应用程序内存扩展aws ec2集群

来源:互联网 

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.

我有一个部署在aws ec2集群上的java应用程序。我根据cpu使用情况配置了自动扩展,但问题是应用程序不是CPU密集型但是IO密集型,CPU使用率平均为20%,因此当流量增加时,它无法实时发送所有消息导致缓冲。这导致消息到达下游系统的延迟。

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

如何根据已部署应用程序的传入流量和堆使用情况自动扩展我的群集?

2 个解决方案

#1


2  

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

为此,您应该使用自定义指标,默认情况下,CloudWatch不会收集内存消耗。要启用此功能,您应该使用自定义指标脚本,然后您就可以更改与内存消耗范围相对应的自动缩放组行为或您需要监视和响应的任何其他事件

#2


0  

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.

您可以创建一个与cron一起运行的bash脚本,用于收集Java堆内存使用情况和传入连接,然后将其发送到cloudwatch自定义指标。

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

如何从AWS ec2实例收集内存和磁盘统计信息

Examples in Perl

Perl中的示例

And then Alert and Auto scale based on those custom metrics

然后根据这些自定义指标进行警报和自动缩放


分享到: