Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Indy UDP readevent doesn't use dual core/multi processors?

www.cryer.info
Managed Newsgroup Archive

Indy UDP readevent doesn't use dual core/multi processors?

Subject:Indy UDP readevent doesn't use dual core/multi processors?
Posted by:"Mike" (johnson..@zonnet.nl)
Date:1 May 2006 12:06:31

I wrote an example application with an UDP server and an UDP client. I need to support as much packets as possible. The problem is that since the OnUDPread (with threadedevent = true) the handling of the incoming packtes isn't really multithreaded even though the event itself is in a thread (it is just one thread since UDP is connectionless). This means
that on a dual core machine only 1 processor is used and the total CPU usage maxes out (when there are enough UDP packets via a LAN) to 50% leaving the extra core only handling other processes.

What I really would like the other CPU to do is handle the rest of the packages when the other CPU is full?

Possible solutions I tried:

A) Two udpservers, this works fine and both CPU's are used, but this is obviously only possible if the listen to different ports, I would really like all the client to send to the same port.
B) Start a queue which is handled by a seperate workerthread, but this means so much extra work by maintaining the queue and using criticalsections that it doesn't provide a real benefit.

The point is that what needs to be done in the onudpread event is so trivial that a workerthread doesn't help, it only needs to relay the packet to a different IP address.

Any help would be appreciated?

Replies:

www.cryer.info
Managed Newsgroup Archive