473,769 Members | 3,872 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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!!!

Jul 23 '05 #1
3 1754
On Mon, 04 Jul 2005 14:05:07 +0400, FrankEsser <es****@gmx.d e> wrote:

[]
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?


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
<fi************ ****@gmail.com>
Jul 23 '05 #2
FrankEsser wrote:
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.
I'm not sure what you mean. The thread pool is threads waiting for work.
Is the work queued in FIFO order?

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!!!


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.
Jul 23 '05 #3
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.

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2498
by: Bruce Bon | last post by:
The class below is intended to play a Sun audio file (.au) in the background while the main thread, which is servicing a GUI, continues without impact. It doesn't work. For a sound file that takes 3-5 seconds to play, the main thread hangs for that long. I have run this many times, with changes in printouts and insertion of strategic sleeps to try to make sure that the player thread gives up control, but apparently the call to...
4
5433
by: Matthew Groch | last post by:
Hi all, I've got a server that handles a relatively high number of concurrent transactions (on the magnitude of 1000's per second). Client applications establish socket connections with the server. Data is sent and received over these connections using the asynchronous model. The server is currently in beta testing. Sporadically over the course of the day, I'll observe the thread count on the process (via perfmon) start climbing....
20
3032
by: Doug Thews | last post by:
I ran into an interesting re-pain delay after calling the Abort() method on a thread, but it only happens the very first time I call it. Every time afterward, there is no delay. I've got a delegate inside the UI that I call to update the progress meter. I use the Suspend() and Abort() methods based on button events. I can watch the progress meter increase just fine when the thread is running. When I select Start, I enable the Cancel...
37
8908
by: ales | last post by:
Hello, I have a problem with creation of new thread. The method .Start() of newly created thread delays current thread for 0 - 1 second. Cpu while delay occurs is about 5%. Any idea? Here is code used for measuring:
0
1296
by: herbert | last post by:
My application is a message gateway. It uses several threads to send, receive and log messages. The send thread is time critical, transmitting emergency stops. Using default settings it takes too long to get a message out of the PC. Currently running as a console app I have seen severe delays especially when other applications are started at the same time. The class lib when finished will be used in a windows service. So priority boost...
51
54872
by: Hans | last post by:
Hi all, Is there a way that the program that created and started a thread also stops it. (My usage is a time-out). E.g. thread = threading.Thread(target=Loop.testLoop) thread.start() # This thread is expected to finish within a second
13
11285
by: LordHog | last post by:
Hello all, I have a little application that needs to poll a device (CAN communications) every 10 to 15 ms otherwise the hardware buffer might overflow when there are message burst on the bus. I would implement an interrupt driven model, but the external device (which is connected via USB) does not support interrupts therefore the device needs to be polled at a specific interval. So my question is how can I implement a "deterministic"...
9
1864
by: cgwalters | last post by:
Hi, I've recently been working on an application which does quite a bit of searching through large data structures and string matching, and I was thinking that it would help to put some of this CPU-intensive work in another thread, but of course this won't work because of Python's GIL. There's a lot of past discussion on this, and I want to bring it up again because with the work on Python 3000, I think it is worth trying
34
2815
by: Creativ | last post by:
Why does Thread class not support IDisposable? It's creating quite some problem. Namely, it can exhaust the resource and you have not control over it.
0
10206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10035
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7403
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.