Last post Feb 22, 2017 11:27 AM by mgebhard
Feb 21, 2017 09:07 AM|Athar Ali Khan|LINK
I have a requirement to develop service that handles multiple requests. Client wants to send more that 100 requests at a time.
Can I use the below attributes to handle multiple requests with multiple threads? Are there any drawbacks? Please share your experience. Thanks
ConcurrencyMode = ConcurrencyMode.Multiple)]
public class HelloWorldService : IHelloWorldService
Feb 21, 2017 12:48 PM|mgebhard|LINK
IIS and WCF handles multiple concurrent requests by default. There is really no way to know if the attributes you selected are correct because we don't know the specification of your service. However, ConcurrencyMode = ConcurrencyMode.Multiple is probably
not what you want.
What problem are you trying to solve and are you receiving errors or unexpected results. If so, what are the errors and unexpected results.
Are you receiving errors while stress testing the service? If so, is the client explicitly closing connections? This is by far the biggest issue I see with WCF when under a load is the client not closing connections and handling faults. What happens
is the connections queue and the application slows down while it waits of connections to open.
Feb 22, 2017 02:43 AM|Chris Zhao|LINK
When the service is set to Multiple Concurrency Mode, the service allows multiple accesses at the same time. Each service has multiple threads processing messages concurrently. The service implementation must be thread-safe to use this concurrency mode.
#WCF Concurrency (Single, Multiple, and Reentrant) and Throttling
Feb 22, 2017 07:06 AM|Athar Ali Khan|LINK
Currently what's happening is Web Service gives different responses to the same request. I have a requirement to create a web service to return Exchange rates from Database against the FromCurreny and ToCurrency. User pass two input parameters,
web service fetch the Exchange Rate and reply as a Class object. To avoid different response issue "Lock" has been implemented on every request and it makes other requests wait.
I want to enhance and convert the same to WCF service to handle multiple client requests and make sure request gets the relevant response.
Feb 22, 2017 11:27 AM|mgebhard|LINK
Of course you must use a lock because you configured WCF to use one instance for multiple requests. You need the lock because local member variable are shared across every request. Why would purposely configure WCF this way given your requirement?
Simply use the default configuration (remove the attributes) and WCF/IIS should work fine because each request will get a new instance of the WCF class. I generally throttle the service to get the most performance while protecting the service.