Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java performance with very large amounts of RAM

I'm exploring the possibility of running a Java app on a machine with very large amounts of RAM (anywhere from 300GB to 15TB, probably on an SGI Altix 4700 machine), and I'm curious as to how Java's GC is likely to perform in this scenario.

I've heard that IBM's or JRockit's JVMs may be better suited to this than Sun's. Does anyone know of any research or data on JVM performance in this situation?

like image 284
sanity Avatar asked Dec 05 '08 14:12

sanity


People also ask

Why does Java consume so much memory?

Java is also a very high-level Object-Oriented programming language (OOP) which means that while the application code itself is much easier to maintain, the objects that are instantiated will use that much more memory.

How much RAM does Java take up?

The JVM has a default setting of 1/4 of main memory. If you have 4 GB it will default to 1 GB. Note: this is a pretty small system and you get get some embedded devices and phones which this much memory. If you can afford to buy a little more memory it will make your life easier.

Why JVM heap utilization is too high?

This is because the JVM steadily increases heap usage percentage until the garbage collection process frees up memory again. High heap usage occurs when the garbage collection process cannot keep up. An indicator of high heap usage is when the garbage collection is incapable of reducing the heap usage to around 30%.

Does Java affect performance?

The most common performance problem associated with Java™ relates to the garbage collection mechanism. If the size of the Java heap is too large, the heap must reside outside main memory. This causes increased paging activity, which affects Java performance. Also, a large heap can take several seconds to fill up.


6 Answers

On the Sun JVM, you can use the option -XX:UseConcMarkSweepGC to turn on the Concurrent mark and sweep Collector, which will avoid the "stop the world" phases of the default GC algorithm almost completely, at the cost of a little bit more overhead.

The advise to use more than on VM on such a machine is IMHO outdated. In real world applications you often have enough shared data so that the performance with the CMS and one JVM is better.

like image 82
kohlerm Avatar answered Sep 30 '22 23:09

kohlerm


The question is: do you want to run within a single process (JVM) or not? If you do, then you're going to have a problem. Refer to Tuning Java Virtual Machines, Oracle Coherence User Guide and similar documentation. The rule of thumb I've operated by is try and avoid heaps larger than 1GB. Whereas a 512MB-1GB full GC might take less than a second. A 2-4GB full GC could potentially take 5 seconds or longer. Obvioiusly this depends on many factors but the moral of the story is that GC overhead does not scale linearly and once you get into the one second range performance then degrades rapidly.

like image 27
cletus Avatar answered Sep 29 '22 23:09

cletus


Sun's JVM allows you to configure and optimize the heck out of garbage collection, but it's a science unto itself: http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html

You might have to do some reading and research, but for that kind of machine, GC settings optimized for the machine and application probably make a big difference.

like image 44
Michael Borgwardt Avatar answered Oct 01 '22 23:10

Michael Borgwardt


Since 5.0 the Hotspot JVM uses a concept know as Ergonomics to try to optimise the memory usage. This is based on more than just the sheer amount of memory available and effects heap sizes, generation sizes and garbage collection algorithms.

Start by having a read of this, which explains Ergonomics and more:

https://www.oracle.com/technetwork/java/javase/memorymanagement-whitepaper-150215.pdf

There's also a guy called Brian Goetz that's written numerous articles about how Java allocates and uses memory, all of which and more can be found here:

http://www.briangoetz.com/pubs.html

like image 38
Nick Holt Avatar answered Oct 02 '22 23:10

Nick Holt


This is not at all answering your question, but if you plan do deploy a huge Java app you might be interested in looking into Azul Systems appliances. They say to be able to garbage-collect without creating a pause in the application up to a single 670 GB heap.

like image 34
Vinko Vrsalovic Avatar answered Oct 02 '22 23:10

Vinko Vrsalovic


You might want to consider running a virtual Terracotta cluster on this machine.

like image 37
John Nilsson Avatar answered Sep 29 '22 23:09

John Nilsson