This content has been marked as final. Show 8 replies
youhaodiyi wrote:Yes, there will be a performance difference: your machine must do the work to have two JVM's in memory at the same time--that overhead is not free.
I have a machine with 4G memory and I want to deploy my Java application on this machine and make good use of the 4G memory. The Java application is very performance cost and it requires at least 3G memory. Compare these two situations below:
1. I set up two JVM and each of them use 1.5G memory in this machine.
2. I set up one JVM which uses 3G memory.
BTW: what OS are you running? MAC, Solaris, Linux? You're not doing option 2 on a Windoze box, or do you like to say page out to disk.
youhaodiyi wrote:Much better than if you were trying to do this in Windoze
I am doing this on Linux.
Could you tell me which one in better? and why?In my opinion the single JVM and using multiple threads is better: the reason being that JVM instances are not free--they take resources when loaded and each has maintenance overhead that needs to have resources.
what do you mean by "page out to disk"?Virtual Memory, swap out to disk, a function which is at best 1000 times slower than if you can fit everything in memory.
youhaodiyi wrote:Is what different among OS?
Is this different among OS?
If that is in response to what I had posted:
Yes and No: while some OS's have more overhead and some can manage resources better than others, each program ran competes for resources in some manner--memory, CPU, I/O, and etc. That is a fact of computing and does not change due to OS. On some systems you can design your hardware configuration to take advantage of multiple CPUs, distributed memeory, multiple I/O busses, and other hardware features, but none the less, competition will happen at some level.
The physics of RAM vs HD is plain and simple... how fast can your read and write an HD and how fast can you read and write RAM... If you have an HD that is faster than 1000 times slower than your RAM, I really want to know about it--I'm talking physical reads and writes not caching.
According to the JDK6 man page in Linux, you will be constrained to a maximum value for the Xmx heap size flag of "approximately 2000m minus overhead" so you won't be able to set a 3Gb heap. In which case your two 1.5G JVMs may in fact make better use of the resources.
On Solaris 7 and Solaris 8 SPARC platforms, the upper limit for [the -Xmx flag value] is approximately 4000m minus overhead amounts. On Solaris 2.6 and x86 platforms, the upper limit is approximately 2000m minus overhead amounts. On Linux platforms, the upper limit is approximately 2000m minus overhead amounts.