WCF Throttling , InstanceContextMode and ConcurrencyMode - wcf

Which ConcurrencyMode and InstanceContextMode combination is best for WCF REST services considering heavy load?

Related

WCF 4.0 ConcurrencyMode.Multiple and InstanceContextMode.Single Scalabiltity

I have a stateless WCF 4.0 (IIS 7.5) configured with
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
Question 1
Does InstanceContextMode.Single have any impact when configuring ConcurrencyMode.Multiple ?
Question 1
In order to have better Scalabiltity (hunders calls per second), should I change it to InstanceContextMode = InstanceContextMode.PerCall ?
Thanks

Workflow 4 Service Application and InstanceContextMode & ConcurrencyMode

The question is pretty simple: how do you set InstanceContextMode & ConcurrencyMode in WF4 WCF Workflow Service Application?
You don't, they have no effect of workflow services.

Which gives better performance: WCF RIA services or Domain Services?

I am building a new SV application which will be used from the Internet. I am expecting to
have a few users at a time, so I will need good performance.
Which is better to use:
build from 0 WCF RIA services or
use Domain Services?
On WCF RIA I can set up a service behavior for ConcurrencyMode but for Domain Service I couldn't find any info about that.
Also I am a little new to this so be gentle :).

wcf service start

I have a wcf service inside a windows service. Inside the wcf service I have a http listener which needs to be started automatically when the windows service is started. Any ideas?
Thanks for the answers but I found the solution
In order to have your constructor called, you need this:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]
can you not use IIS to host the WCF service, it has the WAS (Windows Activation Service ) to start the WCF Service?

WCF - Handling request from multiple clients

My WCF service library is hosted as a Windows Service and is supposed to handle requests from multiple clients.
One request that clients are going to make frequently is pretty resource intensive.
I have two doubts pertaining to above scenerio:
How a WCF service handles multiple client's request?
Is there any WCF configuration to make the process efficient?
Thank you!
In your default scenario, the WCF service host (the thing hosting your service class) will create a new instance of your service class for each request that comes in, and lets that handle the request ("per-call" activation).
You can tweak the maximum number of those concurrently active service class instances using the serviceThrottling behavior on your server.
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ThrottledServiceBehavior">
<serviceThrottling
maxConcurrentCalls="25"
maxConcurrentSessions="25"
maxConcurrentInstances="25"/>
</behavior>
</serviceBehaviors>
</behaviors>
There's a really good explanation of the options of the service throttling behavior and its default values in Kenny Wolf's blog post here.
Also, setting of the InstanceContextMode and ConcurrencyMode on your service class (that implements the service contract) have a strong influence on how your service will handle concurrency and multiple requests.
[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall,
ConcurrencyMode=ConcurrencyMode.Single)]
class YourServiceClass : IYourService
{
.....
}
InstanceContextMode should be PerCall (each calling request gets a new, separate instance) and then ConcurrencyMode can be Single (which is the easiest to develop).
InstanceContextMode could also be PerSession if you need a session-based approach (not very common), or Single (your service class would a singleton - highly discouraged to use this, unless you absolutely, positively have to and know about all the quirks and problems with it!).
ConcurrencyMode could also be Reentrant (only relevant for duplex contracts and bindings) or Multiple (multithreaded singleton service class - highly risky and difficult to develop!).
Marc