1752681 Members
5718 Online
108789 Solutions
New Discussion юеВ

Thread creation rates...

 
David Gourley
Occasional Contributor

Thread creation rates...

My understanding is that when a thread is created or destroyed, a thread in the system will have to lock some sort of kernel data-structure (since each thread has a unique incremented ID in the system).

So if I have a system running on a multi-cpu server, there is a risk of lock contention if there is a high thread creation rate.

So my question is:

What constitutes a 'high' thread creation rate? At what point do I need to worry about this?

(Operating system version: 11i (11.11) and 11.0.)

Hardware: primarily rp5470 with 1,2 or 4 CPUs.

The reason I'm interested in understanding this is that we have a 3rd party application forming part of our system which generates up to several hundred transient threads per connected process every 2 minutes (these threads are created and exit within a couple of seconds) So thread creation on my server is very bursty, and I'm concerned that this is causing significant performance problems during these bursts.

Thanks!

Dav

 

 

 

-------------------------------

P.S. This Thread has been moved from HP-UX --> Workload/Resource Management to HP-UX --> Languages & Scripting - Forum Moderator

2 REPLIES 2
Laurent Menase
Honored Contributor

Re: Thread creation rates...

Hi Dav,

There will be some serialisation for sure, and the more there is CPU, the more you will pass time on spinlock while doing it.
But I have no data on what will be the influence of those partials serialisations.

If you want to see better, just use glance, and look at the time spend in pthread_create().
This with one cpu, 2 cpu and 4 cpu.
If you see the rate of the pthread creation decrease/cpu, or the time spend in pthread_create() increase, it means we have such serialisation. ( - on 11.11 the structure of the thread table should bring some improvment there)

But in any case the best way to do such a server is to have a pool of static threads, waiting for virtual threads to be executed ( on a queue of actions to do)
David Gourley
Occasional Contributor

Re: Thread creation rates...

OK: I understand it's best to use a thread pool.... the problem is that the code generating the transient threads is 3rd party and I don't have the source :-(

Question for the supplier of the software then... (especially since their code is supposed to implement thread pools...)