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

How to forcibly use Java on Openshift's single small gear

Generally speaking, in order to run Java Applications on Openshift, use larger instance than small gear and make them scalable.

But if we can use it comfortably on the small instance, we can use them free within 3 gears. I'm doing experiment to use it with my product's official site. And now a day, I found the answer to do that.

The points to use it is below.

  • Do not use high level library
  • Fully use Young GC
  • Manage memory usage in your application

Do not use high level library

The Openshift supports a lot of useful library and Wildfly application server. But we can not use it, because it uses a lot of memory.

We must fix the permanent memory(heap memory) keep small, and this is essential. By quoting the amount permanent memory correctly, we can assign more memory to the new area of Java heap.

So, I removed the JSP compiler and other unnecessary servlet.

Fully use Young GC

As I wrote before, Java Vm tuning for Openshift. Using Young Garbage Collection frequently is essential.

After the article, I reduced the heat memory, so it come to avoid to conflict memory usage with PostgreSQL.

Java memory usage

The permanent use of the memory is almost fixed, the other usage is below.

  • Global data
  • Volatile and temporary variable's data

Manage memory usage in your application

When you write program code, do you think about memory usage seriously? I do not think about that seriously but where it is critical, before I started developing the Alinous-Core.

But Alinous-Core has simple VM and it manage variables used in the VM. And also has own thread pool to manage threads. It is because too many threads cause useless memory provisioning.

It is very hard to use Java on the small gear of the Openshift, but it is not impossible. The Openshift online is excellent cloud platform for free users. I thank for the RedHat very much !

About development status of CMS

At last, my development status of next content management system come to the final phase. it is about to release.

According to the result of my testing, not only the CMS but also eye-tracker using mouse move and heat map generator can work on the Openshift online's small gear.

After I release that, please try it !


Go to Top