Fast Producer and Slow Consumer
2 posts in topic
Flat View  Flat View

Posted By:   deepak_jairath
Posted On:   Thursday, April 27, 2006 06:41 AM

I have a application which recieves UDP packets from a UDP server.On the recieving end i have two thread one thread for recieving the packets and other thread for doing the processing on the packet.The issue is the speed with which i recieve UDP packets is very high and the processing thread takes some time to procees these packets.I am using
LinkedList as PacketQueue.After some time of processing there are too many packets in the PacketQueue which are still to be taken out by the consumer thread.So when i add a new packet to the PAcketQueue it gives me OutOfMemoryException.Please somebody help me out with this.
Thanks in advance

Re: Fast Producer and Slow Consumer

Posted By:   Jani_Kaarela  
Posted On:   Thursday, May 4, 2006 01:59 AM

The problem isn't necessarily in the packet processing - for example, it could be that the packet receival thread is mostly holding the lock of the queue, causing the processing thread to block most of the time.

You need to do some benchmarking and debugging to see, what actually is the problem.

Re: Fast Producer and Slow Consumer

Posted By:   Christopher_Koenigsberg  
Posted On:   Wednesday, May 3, 2006 06:55 PM

Maybe you need more than one consumer/processor thread?

Also maybe "double buffering" will help?
About | Sitemap | Contact