This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
We are in the process of moving to new server infrastructure
Intel Xeon quad core
We have hosted two websites and two applications on a single JBoss AS 5.1 server [virtual hosting]. 2 applications hosted on a single IP [virtual host] and one website with another IP[ localhost] and one more website with another IP[virtual host - a simple website with static pages]
so far so good....
When it comes to the performance of the applications, which are running under virtual hosts are very slower compared to the websites running in localhost and virtual host.
1.Is this a problem with JBoss configuration or it has something to do with firewall settings of the IP?
coz the primary IP, i.e. localhost is loading faster but virtual hosted applications are very slow and the other IP address were added later to our server.
2.How to specify/inform the JBoss/JVM about the availability of the multiple processors? I have used -XX:ParallelGCThreads=8 is this enough are something more has to be done?
Please suggest me some workaround for these issues.
# 1) It is my experience that applications in virtual hosts tend to run slower because they share the disks, causing the applications to be I/O bound.
You can check this is the case by measuring the performance in one virtual machine with the other one shut down. If there is a large difference, your VM's are competing for resources and thus slowing eachother down.
# 2) Java is quite capable of finding out about the cores you have in your machine. Old Java versions required the -server flag to use more than one core, but newer versions will automatically pick up and use all cores.
The switch you set is a tunable of the garbage collector and it is one I would not futz with unless I know precisely what I am doing. So please remove that flag and use -server instead.
IP addresses never influence performance, unless the TCP configuration is screwed up, causing time-outs. This should lead to error messages, not to slow response times.
You don't have to do anything. Or maybe you do - you never said which operating system you are using. So I'll assume Windows or Linux. By default, the OS lets any app use any processor. If the app runs multiple threads (like all Java apps do), then you will find those threads on all of the processors. Sometimes this is not a good thing because of L2 cache thrashing issues, in which case you are better off restricting a Java app to use only 2 or 4 CPUs. But only performance testing will uncover what the best number of CPUs is to allocate to a Java app. JBoss in Action, chapter 14, section 14.4 goes into this in some detail.
The ParallelGCThreads option is for how many garbage collection threads the JVM should use. By default, the JVM allocates 1 GC thread for each CPU (core) up to 8 CPUs, after which it allocates 5 threads for every 8 additional CPUs. Since you have 8 cores, you are already getting 8 GC threads.
Do you know about how Hyperthreading CPU's relate to this?
It depends on the app. Usually you can see some performance gain, say 15-20%, by turning on hyperthreading. But when using hyperthread you have to be very careful if you set processor affinity - restricting the Java app to running on only hyperthreaded cores can cause great pain. What makes matters worse is that there is no easy way to identify how the affinity mask maps to the cores (though I have not recently googled for a tool to help in that).
Shivaprasad P Kanaganahallimath
Joined: Sep 25, 2006
Actually there was not much of delay in loading the applications. In fact the applications were loading very slow coz of the internet security enabled in my system.
So once I disabled the Kaspersky internet security, applications started loading very fast (3 seconds max).