Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many JVM we can have in one machine?

Tags:

java

jvm

I have a class that run infinit (do nothing, just loop and sleep), called NeverReturn. I try to run it using following command in Windows XP 32bit:

java -Xms1200M NeverReturn

I find with the command I can create only 4 java instance at same time. The 5th and next java command will failed to create jvm.

If I change the command to -Xms600M, I can create 8 java instance. The 9th will failed.

Could anyone explain that? I'm using sun jdk1.6 update 23 and jdk1.5 update 22.

like image 365
xeranic Avatar asked Jan 13 '11 09:01

xeranic


1 Answers

If you have four instances of the JVM each using 1200M of memory, that gives you 4800M of memory allocated.

If you have eight instances of the JVM each using up to 600M of memory, that gives you 4800M of memory as well.

If I had to guess, it looks like the problem is that you're trying to promise more memory to the JVM instances than exists on your system. Dropping the amount of memory you promise should have a corresponding increase in the number of instances you can run.

like image 174
templatetypedef Avatar answered Oct 13 '22 01:10

templatetypedef