Thursday, April 26, 2007

Java JVM high memory usage problems

Though I have some three four years experience in C++ ,I did not have
that much oppurtunity to work in Java. Currenly I was doing some
analysis for a very simple CLI and was surprised to come with a memory
restriction. I found that if I use Java for developing the CLI
application I will be exhausting the memory of our Application Server
(AS). Just to mention the architecture ,users (telecom operators) use
a metaframe server client ( =something like remote desktop) to login
to the AS and then open a GUI to work on it. With Java I can service
only about 15 clients with the available memory . I just checked the
reason for this resource crunch and found that already many Java based
GUI's are served by the AS and each is taking some 25 MB or more. The
first thing I thought is that adding more RAM will solve this ( though
this is not an easy option) . Then I understood that a 32 bit system
can have just about 3 gb ram for applciations and our AS had already 4
GB with 1.5 GB VM also configured. Then I thought there might be ways
to make the JVM shareable. But no. Also tried to use the flags to fine
tune JVM. No go there also. Irrespective of how much you limit the
actual limit is in the heap size allocated to the application and not
to the private bytes of JVM.

-----------------------------------------
Data from Jconsole for the Java application

Memory
Current Heap Size 4.3 MB
Max heap size 12. 2 MB ( set by flag)
Committed memory 5 MB
Operating System
Committed VM - 26.7 MB

Data from Perfmon (for java.exe)

Private Bytes - 27.7 MB
----------------------------------------

I am part of a large team that developes and maintains a telecom
network managment software system. Also this software is used all
around the globe almost in around 190 countries usually by telecom
service providers. So this is a very real problem that I am speaking
about. I am getting to love the simplicty of Java and of the great IDE
Eclipse as much as I love the power of STL; but I am comming face to
face with the main constraint of Java, its memory footprint and I
guess thousands of others like me must have faced similar problems.

If so the next question is what is SUN doing about this. I could not
find it in their top 25 RFE's or top 25 bugs. (http://bugs.sun.com/
bugdatabase/top25_bugs.do http://bugs.sun.com/bugdatabase/
top25_rfes.do )

1) Is this really not a problem in the outside world then ?

2) Or is it that with the introduction of 64 bit HW and serveres this
will be of no significance ?

Anyway I doubt if companies like ours will adopt 64 bit HW and servers
because of the costs involved in it ( note this is just a logical
guess, I have no experience in such decisions)

Anyway I am now forced to use C++ for the client and use Java on the
server side. Fortunately most of the Java in the server side is done
up as EJB's all conatined in the JBoss server thus consuming only one
JVM there)
-------
I posted this in a popular Java group and did not get any meaningful replies. So I guess this is one limitation that people are living with ; or that J2EE frameworks amalgamates everything to one large chunk of VM.


1 comment:

Alex Punnen said...

I have been working in Java for years now; 64 bit is the norm now; this concern that I had at at the time of using Java for the first time seems so irrelevant now.

Install/Upgrade NVIDI Driver in Ubuntu for CUDA SDK

Most linux distribution comes with the Nouveau https://nouveau.freedesktop.org/wiki/ display driver configured. If you need to use NVIDIA...