From bb81082e58d90da9971b7e06f4c3f8639446b2d2 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 25 Nov 2014 18:01:12 +0530 Subject: [PATCH] CLOUDSTACK-7951: Limit amount of memory used by cloudstack-agent jsvc The -Xms value specifies the minimum heap size the JVM should start with and -Xmx is the maximum heap size it can grow. The previous fix imposed minimum limit of 1G which is unreasonably for small deployments. The fix is to start with 256MB and limit to 2G for cloudstack-agent process. This was tested on DevCloud/KVM and then again on a ACS/KVM deployment on real hardware. With these values, it's possible for the agent to work in a DevCloud/KVM environment and if JVM needs it can increase the heap size to 2G. The fix also ports these settings to Debian cloud-agent init.d script as well. Signed-off-by: Rohit Yadav --- packaging/centos63/cloud-agent.rc | 2 +- packaging/debian/init/cloud-agent | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/centos63/cloud-agent.rc b/packaging/centos63/cloud-agent.rc index e9b203e8c95..8918e50f13c 100755 --- a/packaging/centos63/cloud-agent.rc +++ b/packaging/centos63/cloud-agent.rc @@ -66,7 +66,7 @@ export CLASSPATH="/usr/share/java/commons-daemon.jar:$ACP:$PCP:/etc/cloudstack/a start() { echo -n $"Starting $PROGNAME: " if hostname --fqdn >/dev/null 2>&1 ; then - $JSVC -Xms1024m -Xmx2048m -cp "$CLASSPATH" -pidfile "$PIDFILE" \ + $JSVC -Xms256m -Xmx2048m -cp "$CLASSPATH" -pidfile "$PIDFILE" \ -errfile $LOGDIR/cloudstack-agent.err -outfile $LOGDIR/cloudstack-agent.out $CLASS RETVAL=$? echo diff --git a/packaging/debian/init/cloud-agent b/packaging/debian/init/cloud-agent index 5720d749ad9..a14e8a2524a 100755 --- a/packaging/debian/init/cloud-agent +++ b/packaging/debian/init/cloud-agent @@ -96,7 +96,7 @@ start() { wait_for_network - if start_daemon -p $PIDFILE $DAEMON -cp "$CLASSPATH" -Djna.nosys=true -pidfile "$PIDFILE" -errfile SYSLOG $CLASS + if start_daemon -p $PIDFILE $DAEMON -Xms256m -Xmx2048m -cp "$CLASSPATH" -Djna.nosys=true -pidfile "$PIDFILE" -errfile SYSLOG $CLASS RETVAL=$? then rc=0