I have a WCF service hosted in IIS that on request does a request to another server using asynchronous socket requests. The request has to be fast (5 seconds) or it times out. When a lot of users are sending requests at the same time (I guess about 10) then what happens is that socket requests to another server are not handled within those 5 seconds. The logs on another server say that the request is received and handled almost immediately and the response is sent back, but the async event is not fired before 5 - 10 seconds causing the wcf service to have a timeout (note this is not a timeout of the wcf itself, but an internal timeout on a call to another server). We think that that thread pool is either too slow to spawn new threads or has some reasons not to do that, which leads to the situation when there are no threads available to pick up the async receive of the socket. As far as I understand both WCF and async socket handlers are using ThreadPool for that so they really fight for the same resource. Did someone encounter similar situation? What is the best way of handling it?
I see two easy ways out:
1) Limit the number of maximum concurrent requests at the wcf service to 5 or something which may cause it to be slower as some requests will have to wait in the queue.
2) Increase the number of MinSize in the ThreadPool I would be glad for any suggestions on the matter.
P.S. The processor has 8 cores, meaning default minsize of threadpool is 8, so I start seeing the problem when more than 8 concurrent requests are happening.