I've done my research and I know the best way to implement a high performance socket server is generally as follows: use async socket operations (specialized SocketAsyncEventArgs/Operations for best performance) and on the async callback, push the request to a processing queue that is tended by a pool of threads.
My questions for this processing model - to have the greatest performance:
1) when should the "End" operation of the socket be called (e.g. EndAccept or EndReceive)? should this be called on the callback thread (IOCP) before queuing the request? or called when the request gets taken out from the queue and gets processed (worker thread)?
2) this question depends on the answer to #1. when should the next "Begin" operation be called? should we call it before we call EndOperation even or should we call it immediately right after EndOperation (before queuing/processing request)?
3) can the processing queue simply be the .NET threadpool? what advantages/drawbacks would using the .NET threadpool vs. rolling out your own synchronized processing queue?
Any help is greatly appreciated.