Solved

One Large JVM vs. Multiple Smaller JVMs

Posted on 2006-07-22
14
626 Views
Last Modified: 2008-02-01
Based on the latest JVM technology (J2SE 5 or higher), hardware and Application Server implementations (e.g. WebLogic 9.x or WebSphere 6.x), which of the following two configurations is better on a multiple-CPU UNIX machine:
1. One large JVM with 2-4 GB heap size and 200+ threads for a single Application Server instance.
2. Two or more smaller JVMs, each with < 1 GB heap size and < 100 threads for an Application Server cluster of multiple application server instances

What are the major pros and cons of each solution?

0
Comment
Question by:nbkd72e
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
14 Comments
 
LVL 26

Expert Comment

by:ksivananth
ID: 17162236
when you increase the heap, the max no. of threads get decreased!

I have read some ehere that 1GB is good trade off!

More instances can share the load and the possibility of crash is less and possible to have failover mech.

0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17162253
> when you increase the heap, the max no. of threads get decreased!
can you pls explain little more? i thought the max no of *active* theads depends on no of CPUs of the box.
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 17162265
>>can you pls explain little more?

for e.g.,

heap         #of threads allowed

-Xmx128m    7500
-Xmx1024m  2500
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 26

Expert Comment

by:ksivananth
ID: 17162267
>>i thought the max no of *active* theads depends on no of CPUs of the box.

though I have not tested this, I don't think so!
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17162292
GC works better on larger heap JVMs than smaller ones. The GC tuning option "-XX:+UseParallelGC" highly depends on the no of CPU available on the box. It would run efficiently if only one JVM is running.

Have a look to various GC options:
http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 84 total points
ID: 17162972
I prefer an application server cluster so that if one process fails by any chance, the system is still reliable.
0
 

Author Comment

by:nbkd72e
ID: 17163605
I really want to hear from people who has done load test and application server performance tuning against those two scenarios, especially the experiences of tuning a high-profile production system.
0
 

Author Comment

by:nbkd72e
ID: 17163663
I was told by some application server vendor consultants a few years back that the second approach would perform better. But I am not sure if that principal is still valid based on the latest JVM, hardware and App Server technologies.

I think it worth to specify my concerns of the single large JVM approach (the first one):

    1) GC - How efficiently the JVM can handle 2-4 GB heap size without causing performance penalties. Do you think having multiple JVMs each handles GC more a smaller heap will be more efficient?

    2) Managing threads - 1000 threads per Java process vs. 200-300 threads per Java process (with 4 Java processes on the same machine), would the second case managing Java threads more efficiently, including thread scheduling, handling Java synchronization (or managing the locks/mutexes/monitors) ?

    3) As somebody already mentioned, the availability and reliability. Having to deal with something extremely large always challenges the underneath technology or implementation, and potentially need more time to get mature.
0
 
LVL 23

Assisted Solution

by:Ajay-Singh
Ajay-Singh earned 83 total points
ID: 17163869
1) GC runs better on larger heaps. So, multiple JVMs with smaller heap would degrade the performance.
2) The number 1000 is pretty huge if you talk about no of threads you should configure your application with. You really need much more cpu to handle it. At a given moment the number of active threads active (on the cpu) would be no of CPUs. Because of IO wait and other waits on the application you can spawn more threads than no of cpus on the box, but the thread no 1000 is really big.
3) If you want to run multiple instances of same JVM on the single box for more availability - its really bad design. If the box goes down for some catastrophic failure, everything would blackout.
0
 
LVL 26

Assisted Solution

by:ksivananth
ksivananth earned 83 total points
ID: 17164257
>>If you want to run multiple instances of same JVM on the single box for more availability - its really bad design. If the box goes down for some catastrophic failure, everything would blackout.

Not exactly, there is no rule that you have to run in single system, we don't expect the cluster running in single system.

>>GC runs better on larger heaps. So, multiple JVMs with smaller heap would degrade the performance.

We design the application not for GC, its for app performance! Of course, heap spec is at runtime. It is not controled by either of the design. I feel, it is to decide if multi node or single node!

The reason for multinode is load balancing and failover.

With single node approach, the two is not possible. Even if you vconfigure single node with high config 2GB... what will you do if the app recieves more load than this config?

and the other factor is that the effort you can invest. Of course, single node approach needs lesser effort than multi.
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17165267
ksivananth,

I agree we don't design system for GC, but we definitely design system for better performance, and then tune with GC for low pause timings.
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17165273
> With single node approach, the two is not possible.
1 or 2 - its single point of failure.

> Even if you vconfigure single node with high config 2GB... what will you do if the app recieves more load than this config?
You really need very very powerful box or your server is doing nothing (kind of ping server)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question