Operating System - HP-UX
1757453 Members
2623 Online
108862 Solutions
New Discussion юеВ

Single Process, Multiple Threads, Multiple CPUs

 
SOLVED
Go to solution
Abhik Sarkar_2
Advisor

Single Process, Multiple Threads, Multiple CPUs

Hi,

We have a system (L3000, HP-UX 11.00, 1CPU, 2GB RAM) where most of the work is done by a single Java process. The process is multi-threaded. There is another Java process which does the rest of the work.

During peak load, this process takes over 90% CPU, and on the whole, the CPU is fully loaded.

The expected load on this system is expected to double, and it has been suggested that the best way forward to handle the addional load would be to add another CPU and double the RAM to 4GB.

What I am interested in knowing is whether will this work? Since there is only one process taking almost all the CPU, is it possible that when we add another CPU, the same process will be able to use both CPUs? Will HP-UX balance various threads of the process over the two CPUs?

Thanks,
Abhik.
6 REPLIES 6
Hein van den Heuvel
Honored Contributor
Solution

Re: Single Process, Multiple Threads, Multiple CPUs

Yes, a multi-Threaded program will automatically get a fresh idle cpu assigned for every computable thread.

The urgency in your upgrade would appear to be the CPU. More memory never hurts, but I see no immediate indication that it will help either.
Most systems hit only one bottleneck at a time. In your case that was the cpu. The memory bottleneck may be just around the corner, or miles away. A vmstat / sar monitoring may or might not give an indication.
The Java application you have may well already have allocated all the memory it will ever need.

Anyway, two CPU systems behave soooo much nicer (responsive) in general. YOur business will like it.

Hein.


Dave Olker
HPE Pro

Re: Single Process, Multiple Threads, Multiple CPUs

Hello Abhik,

Hein is most likely correct, however the one piece of information that's missing from your post is the number of threads running at any one time - especially when the process consumes 90% of the CPU.

Even though you say your process is multi-threaded, you should verify - with a tool like GlancePlus - that when the application is consuming large amounts of CPU there are multiple threads running for this process.

Even if the process is capable of running multiple threads, there is no guarantee that when it's consuming lots of CPU time it is doing so with multiple threads. If only a single thread is running and taking all the CPU time then a second CPU will likely not help. If the process has numerous threads running while the CPU is busy then a second processor will help tremendously.

Another corner-case to be concerned with is processor affinity. If your application uses processor affinity to "bind" the threads to CPU0 then a second CPU will likely not help. However, a normal java application should not be using processor affinity, so this is unlikely to be the case.

Regards,

Dave
I work for HPE

[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
Abhik Sarkar_2
Advisor

Re: Single Process, Multiple Threads, Multiple CPUs

Hein, Dave,

Thanks so much for your replies. Though I am only involved in operations/administration of the application, I know it well enough to know that it has multiple threads in "running" state at the same time. There is no one thread which could take so much CPU. Unfortunately, Glance is not installed on the system, so I can't confirm it in any way... but again, thanks for your replies.

Best regards,
Abhik.
Dave Olker
HPE Pro

Re: Single Process, Multiple Threads, Multiple CPUs

Hi Abhik,

You can download an evaluation copy of GlancePlus free of charge from the following web site:

http://www.openview.hp.com/products/gplus/download.html

Once installed, you should be able to confirm how the threads are behaving. This would be good to know especially if you add a second CPU. Glance will show you how the threads are spread across the CPUs.

Regards,

Dave
I work for HPE

[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
Abhik Sarkar_2
Advisor

Re: Single Process, Multiple Threads, Multiple CPUs

Thanks for the link Dave. I will try it out.

Best regards,
Abhik.
Hein van den Heuvel
Honored Contributor

Re: Single Process, Multiple Threads, Multiple CPUs

Ahik,

You're welcome!

> I know it well enough to know that it has multiple threads in "running" state at the same time.

Good, an other indication that more CPUs will be good.
Let me clarify on what I meant with systems running 'nicer'.
FOr example, say you had 'only' 50% average CPU.
This could be because of 2 end-user jobs taking 2.5 second CPU each in the same 10 second window. There is 50% change that they will overlap some, slowing down each other. In the worst case, they overlap all the time. This may sound unlikely, but external and internal events may well cause unexpect synchronization of tasks. Say a network glitch freezing both at different times and unblocking at the same time. With a second CPU they coudl really work in parralel and you could half the response time for what would have been the slowest of the two. (depend on scheduler: timeslice 1 cpu quickly and both end after about 5 seconds: average. Finish one first and then start the next will give on 2.5s, the other 5s for an average of 3.75s.... fun with math)

>>> There is no one thread which could take so much CPU.

Sure there is.. the garbage collector. Seriously. While I never needed to understand details, I have heard that Java solution often spend a lot of time in the memor management clean up jobs in a 'non-productive' parallel task. Again, a second CPU will allow a real job better response time.

Cheers,
Hein.