Created time: 2014-08-14 Last updated time:

Java Vm tuning for Openshift

The openshift is cloud server, categorised in Paas cloud. in order to use Paas cloud, tuning JVM is essential.

Openshift's environment

Openshift provides gear. This site use the Small Gear. The Gear means a virtual server.

In this gear , we can use 500MB memory. Therefore if the quantity of memory used in the gear overflow that, the Openshift's quoter stop the process using a lot of memory or limit CPU time available.

Actually before I did tuning, the process of Alinous-Core stops or suddenly freezes  when publishing the page of CMS, or a lot of access comes.

By by doing tuning of Java Virtual Machine, it works very fine.

How to tune the Java VM

Alinous-Core Openshift Cartridge uses Tomcat J2EE Container. So we can tune the VM by adding JAVA_OPTS in the "" located in "[CATALINA_HOME]/bin".

Alinous-Core uses a a lot of heap memory, but uses little permanent memory. Therefore I adapted following strategy.

  • Use 300MB memory
  • Provision heap memory as possible as we can
  • Use Young Garbage Collection frequently in order to discard temporary object as soon as possible

Then the script is below.

By using "-XX:NewRatio" and "-XX:SurvivorRatio=32" parameters, it provision new object's area as large as we can. So the garbage collection occurs frequently.

How to check the VM

After overwrite the "", restart the gear and login with the ssh. And use "jps" and "jstat" command. The jps can shows the vm id.

After that use jstat command with the vm id.

The YGC(Young Grabage Collection) occured frequently. This log line is added by every 3000 milliseconds.

After doing this tuning, the cartridge works very fast. So if you are going to use Java on the Openshift, I recommend you to do that.

Go to Top