Simple question, complex problem:
A LOT of data coming in from the network on a single socket, faster than one thread can consume. In fact, even dispatching the work to the ThreadPool
takes too much time.
So I add the incoming items to a BlockingCollection<T>
and then dispatch them on a separate thread.
However, at times of high usage, it can still take too long. I tried stripping the BlockingCollection<T>
and ConcurrentQueue<T>
implementations to remove some extraneous features but it made little difference.
What kind of single-write multi-read concurrent queue implementation could beat the BlockingCollection<T>
? The data must be consumed ASAP.