WCF Asynchronous Call Slow, Synchronous Call Fast
I have created a simple WCF service using ws2007HttpBinding which just returns the integer passed to it.
When I call it synchronously, the first call is under 100ms, then the subsequent calls are under 10ms
When I call it asynchronously the first call is approximately of the order of 1000ms,开发者_JS百科 subsequent calls are also of the order of 1000ms
Am I missing something when calling the service asynchronously. This seems very slow, the service has virtually no processing logic in it
I have tried this with the client and server on the same machine and on different machines. I go the same result
I thought it was the bug where threads were only being created every 500ms, but I implemented this and it made no difference.
If anyone knows the answer can they post their code and service/client configuration
This is quite urgent for me so any help would be appreciated
How do you get the time? Is the time you listed here actually the response time?
Since you use the asysnchronous way, you can't know whether the call will be scheduled to invoke. If you think the time is critical, it's better to use synchronous way.
I just found out the threading issue seems to be on the client, not the server. Once I set the minimum thread count using ThreadPool.SetMinThreads.
I'll do a bit more investigation and post if I find anything
精彩评论