Connecting Tech Pros Worldwide Help | Site Map

Thread time - strange delays

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 23rd, 2005, 05:49 AM
FrankEsser
Guest
 
Posts: n/a
Default Thread time - strange delays

Hello!

I am not an expert on C++ programming and therefor I have a question:

We use a kind of communication server that was written in C++
especially for our company. It just takes incoming socket requests,
connects, evaluates incoming data packages and gives them to certain
plug-ins adressed in the frame of the data packages. For each data
package management an own thread is started. The data packages can
arrive faster than the processing in the plug-ins so there is a kind of
simple thread pool holding the data packages until they are processed.

The system was quite stable for many years and now we suddently have a
strange effect: Some data packages are sent by network clients but they
are put to the corresponding plug-ins with a delay of 2 to 15 Minutes
!!!

The system performance shows that there is no overload (about 20%
processor usage in task manager).

It seems that the effect occurs in the thread pool.

The only difference to all other systems we are running is that this
certain system is a server with a real dual processor hardware.

My question: is there any known issue about my problem on dual
processor systems?
If not, does anybody have any idea of what could cause our problems?

Any answer is welcome!!!


  #2  
Old July 23rd, 2005, 05:49 AM
Maxim Yegorushkin
Guest
 
Posts: n/a
Default Re: Thread time - strange delays

On Mon, 04 Jul 2005 14:05:07 +0400, FrankEsser <essfra@gmx.de> wrote:

[]
[color=blue]
> The only difference to all other systems we are running is that this
> certain system is a server with a real dual processor hardware.
>
> My question: is there any known issue about my problem on dual
> processor systems?
> If not, does anybody have any idea of what could cause our problems?[/color]

It might be that you do not do proper locking for your thread shared data.
It might go unnoticed on a single processor.

--
Maxim Yegorushkin
<firstname.lastname@gmail.com>
  #3  
Old July 23rd, 2005, 05:49 AM
Joe Seigh
Guest
 
Posts: n/a
Default Re: Thread time - strange delays

FrankEsser wrote:[color=blue]
> Hello!
>
> I am not an expert on C++ programming and therefor I have a question:
>
> We use a kind of communication server that was written in C++
> especially for our company. It just takes incoming socket requests,
> connects, evaluates incoming data packages and gives them to certain
> plug-ins adressed in the frame of the data packages. For each data
> package management an own thread is started. The data packages can
> arrive faster than the processing in the plug-ins so there is a kind of
> simple thread pool holding the data packages until they are processed.
>
> The system was quite stable for many years and now we suddently have a
> strange effect: Some data packages are sent by network clients but they
> are put to the corresponding plug-ins with a delay of 2 to 15 Minutes
> !!!
>
> The system performance shows that there is no overload (about 20%
> processor usage in task manager).
>
> It seems that the effect occurs in the thread pool.[/color]

I'm not sure what you mean. The thread pool is threads waiting for work.
Is the work queued in FIFO order?
[color=blue]
>
> The only difference to all other systems we are running is that this
> certain system is a server with a real dual processor hardware.
>
> My question: is there any known issue about my problem on dual
> processor systems?
> If not, does anybody have any idea of what could cause our problems?
>
> Any answer is welcome!!![/color]

How many threads can you have running concurrently? Usually it's the size
of your thread pool. If you have too many threads, starvation can occur,
ie. not all threads will make forward progress in a timely manner. This
is a problem with scalability of the system scheduler w.r.t. the number of
threads it can run concurrently. Try having fewer threads in the thread
pool or change the scheduling policy to SCHED_RR or SCHED_FIFO if they're
supported on your platform. The other thing is that adaptive mutexes with
SCHED_OTHER may have scalability problems even if the thread pool size
isn't large enough to cause scalability problems otherwise. If you go to
one of the other scheduling policies, that may help.

SCHED_RR and SCHED_FIFO have more overhead and will reduce overall throughput.
If you have to go to less threads and your thread per connection is
i/o bound, you might want to go to a non-blocking i/o model where the
the session is kept as a user defined lighter weight task and you write
your own scheduling mechanism (simple FIFO queue) to schedule i/o and work
on the sessions. Some of the web servers and other server apps use that
strategy.

--
Joe Seigh

When you get lemons, you make lemonade.
When you get hardware, you make software.
  #4  
Old July 23rd, 2005, 05:50 AM
pven
Guest
 
Posts: n/a
Default Re: Thread time - strange delays

Hi,

May be you should compare your thread pool implementation with a
standard POSIX implementations and see how they are different.

The thread pool implementation will be mostly a few function calls that
you can easily map.

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.