2

In our scenario, we launch 20+ java processes to deal with our business, we find each process eats 500M+ memory, so we consumed several G memory on the server in total, the customer complains their server become slowly once launch our processes.

I had a trial, even for a simplest "HelloWorld" program in HP-UX, it eats 500M memory! If I set -Xmx for it, seems likely it can't be cut down to less than 320M. Actually, we hope our each process just consume 64M memory.

So, any one know how to set memory limit for Java program to 64M-128M on HP-UX (java6)???

chenmin
  • 131
  • 1
  • 7
  • if you run java on HP-UX what command line keys are available for VM memory control? –  Aug 16 '12 at 05:13
  • $JAVA -Xms512m -Xmx512m alu.nbi.xos.script.FileOutput $@ But even we reduce "-Xms512m" to small value for example "-Xms128m", it still eat 320m+ memory. – chenmin Aug 16 '12 at 08:40
  • As far as I know memory taken by a process and heap memory - are different things. Your process took 320 megabytes, but initial heap size (`xms` key) was set to 128 megabytes. I think it is a virtual machine feature that it takes too much memory on this platform just to be started and running. In other words it may be a bug in JVM that should be reported to JVM vendor. –  Aug 16 '12 at 09:08
  • Rafael, you are right. As we observed on top output, our process consumes very small memory in column "RES" (I think it's our program's heap+stack) but very large memory in column "SIZE" (I think "java" program itself consumed most of all memory). If I can I just want to check with you or others: are each HP-UX platform java has this problem (or we can't call it problem)? Anyone has this experience like me? I didn't find anything about that by google. – chenmin Aug 16 '12 at 09:24
  • Sorry for one point I should correct in the command line I mentioned before: actually we always use the same value to both xms and xmx. When I said reduce -Xms512m" to "-Xms128m" I meant we set both xms and xmx to 128m. – chenmin Aug 16 '12 at 09:32

2 Answers2

0

How are you measuring the amount of memory the java processes are using? top/process-lists aren't always telling you what you might think. It might be worth running jvisualvm (part of the java6 jdk) to see what the memory break down is. If you are running a trivial hello world program then something is going wrong if it really is using this amount of memory.

Paul Jowett
  • 6,513
  • 2
  • 24
  • 19
  • Jowierun, I agree with you very much. We are using top to measure the memory using. I have no chance to run jvisualvm yet, but the current behavior is: once we launch our 20+ small processes the server slow down quickly and sometimes even can not run anything else. – chenmin Aug 16 '12 at 08:50
  • if you run say 20 HelloWorld applications, what does your free memory look like? The article below from MJB looks likely to be useful. – Paul Jowett Aug 16 '12 at 09:25
  • Thank you jowierun I just saw that right now, I will read that carefully. – chenmin Aug 16 '12 at 09:39