Performance and scalability: One vs two server instances on same machine

  1. One vs two server instances on same machine (4 messages)


    I have a question about performance. I wonder if it is better to run two instances of an application server on the same machine versus just running one. Running two instances will surely take up more memory and cpu, but will this setup be able to handle more requests still? Or is it better to run just one so that the machine has more free memory and cpu?

    For information, I am running bea weblogic as appserver(s) and apache webserver in front.

    Any comments?
  2. Hi Morten,

    With the assumption that memory is 'unlimited', I think watching the load of CPU gives the solution. For instance, IF one CPU / one instance = 80% THEN you need a second CPU (machine) for the second instance, however IF one CPU / one instance = 30 % THEN definitely there is room for adding another instance to the same CPU ... This is my guessing !
  3. Which OS are you running on? There are some OS level constraints on Threads and how Application Servers handle themselves on these Operating Systems.

    For instance, on Solaris, each thread is adopted by a LWP ( Light Weight Process ) , when a typicaly VM comes up it starts around 4 LWP's, No matter howmany threads your application launches the it is always only run on 1 LWP per thread group (ideally look into Java Threads on Solaris for More information ). If there was only one CPU on the machine, this is fine and dandy , however if you have more than one CPU, then ideally you want one LWP per processor on the machine. This can be acheived through some OS level primitives ( read JNI calls ). Application server may or maynot make these calls. ( I'd bet that commercial application servers do take advantage of this , I am not too sure , it just seems wrong if they dont).

    On Windows each thread is adopted by a OS level thread and hence spread across processors occurs more elagently ( since JDK 1.2 ). The newer releases of the Linux Kernels also support this feature but my last reading was that JDK 1.4 does not currently handle this situation and hence you might have to go back to the old trusty hack of LD_ASSUME_KERNEL=2.2.5.

    Just some pointers, More research for you I guess unfortunately.

    Hope this helps.
  4. Thanks for your pointers. My server is running on unix with sun solaris os. There are two cpu's on the machine. Are you saying that the two instances' threads should be running on the same LWP? If so, why is that? Also, although there are two CPU's I only want to use one due to BEA licencing policy.

    I will be very grateful for any replies.

  5. IMHO it's very interesting theme.

    My suggestions are following:

    1. since any AS surely has synchronized blocks inside its code - running several instances on a single machine may help to improve throughtput.

    2. This should be an issue for those AS which scale independently - i.e. Servlet Containers - Tomcat, Resin. Applying this to full-featured AS can bring opposite results.

    Any comments ?