I need to create a WCF service that accept client request and internally connect to a remote machine to do the job. The remote machine has a very good processing capacity but not a good processing speed. This means that can process for example 1000 transactions per second but each transaction can take 1 second, so the only way is to have 1.000 concurrent transactions running in the same second.
The remote machine handle very well this situation, but I am worried about WCF, if each transaction is internally (I dont care the client side model (sync or async)) waiting and blocking a thread inside the server for 1 or 2 seconds this could represent a 1.000 working threads live and that could be very dangerous, or maybe WCF use the thread pool and just put others request in a waiting state and that is bad too.
So, my question is about the possibility of processing the request asynchronously in the server side. So the transaction flow must be like this:
Thanks!
You can use the WCF async pattern to achieve this. When you mark your operationContract with the async attribute, WCF uses the IO CompletionPort threads to process the request.
so it works the following way. Your request is handleded by a thread in IIS and once it reaches WCF it goes to sleep and then the IO CompletionPort thread takes the request process it and then sends back the response to the IIS thread that returns the response to the client.
IO CompletionPort threads are much faster and also doesnt slow down your server in terms of performance or resources.
Look at the following link for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With