Fast One Time Multiple Read Collection

Simple question, hard problem:

A lot of data coming from the network into one socket is faster than one thread can consume. In fact, even submitting a job ThreadPool

doesn't take too long.

So, I add incoming items to BlockingCollection<T>

and then post them on a separate stream.

However, during periods of high usage, it can take too long. I tried disassembling implementations BlockingCollection<T>

and ConcurrentQueue<T>

to remove some extraneous functionality, but it didn't really matter.

What single-threaded co-implementation of a multi-read queue can outperform BlockingCollection<T>

? The data should be consumed as soon as possible.

+3


source to share





All Articles