8 Replies Latest reply: Jun 24, 2008 7:35 PM by 807589 RSS

    A question about JVM performance?

    807589
      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.

      Are them same when comes to performance? Does JVM have maximum memory limited?

      thanks.
        • 1. Re: A question about JVM performance?
          807589
          youhaodiyi wrote:
          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.
          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.

          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.
          • 2. Re: A question about JVM performance?
            807589
            I am doing this on Linux. Could you tell me which one in better? and why? what do you mean by "page out to disk"?
            • 3. Re: A question about JVM performance?
              807589
              youhaodiyi wrote:
              I am doing this on Linux.
              Much better than if you were trying to do this in Windoze
              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.
              • 4. Re: A question about JVM performance?
                807589
                Using a single JVM is much less work for you, for the OS and for the JVM.

                Just my 2 krupplenicks worth,

                PS.
                • 5. Re: A question about JVM performance?
                  807589
                  Is this different among OS?
                  • 6. Re: A question about JVM performance?
                    807589
                    youhaodiyi wrote:
                    Is this different among OS?
                    Is what 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.
                    • 7. Re: A question about JVM performance?
                      dcminter
                      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.
                      • 8. Re: A question about JVM performance?
                        807589
                        OK, thanks guys. I think there is no need to create multi-JVM if the Java application cost less then 2GB memory.