Salu

Hi,

This is a example of my Service Contract.

[ServiceContract(SessionMode=SessionMode.Required]
public interface IMyinterface
{
Response AddValueToDB(Request req);
}

[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession,ConcurrencyMode=
ConcurrencyMode.Multiple]
public class MyService:IMyinterface
{

public Response AddValueToDB(Request req)
{
// Some logic to add into DB
return response;
}
}

Now i have my Client which is a multithreaded app.

Steps On Client Side:

I open a WCF Connection by creating a proxy...
I have declare this proxy object globally

Now from 1000 worker threads i try to call

proxy.AddValueTODB(someRequest) using the same proxy object...(Is this fine).

May be after some threads the whole process crashes.. Just wants to be clear what could make this hanppen .. where am i going wrong ...

Any suggestions or answers are expected...





Re: Windows Communication Foundation (Indigo) Concurrency ** Multi Threading Problem

Brian McNamara - MSFT

Is the crash on the server Can you get some diagnostics about the crash (e.g. exception and stack trace) Configuring tracing on the server may help.

http://msdn2.microsoft.com/en-us/library/ms733025.aspx

On the client, you may want to call Open() once on the proxy object before having the 1000 threads use it concurrently, but it should be fine. What binding are you using






Re: Windows Communication Foundation (Indigo) Concurrency ** Multi Threading Problem

Salu

I am using TCP Binding.....





Re: Windows Communication Foundation (Indigo) Concurrency ** Multi Threading Problem

Salu

I am still trying to trace the problem and the crash is on the client... Server is fine...

I am still confused if i have concurrent calls from Client to Server .. will all the call be processed seperatly or one by one... whats the limit on the server side to process the call seperatly... is there any setting which needs to be applied to increase the count...

Thanks
Salu





Re: Windows Communication Foundation (Indigo) Concurrency ** Multi Threading Problem

Brian McNamara - MSFT

With ConcurrencyMode.Multiple, you can have multiple calls executing simultaneously on the server; if you want the calls to be processed one by one, you would use ConcurrencyMode.Single instead.

There are various throttles at the binding and service levels that affect the maximum number of client connections that will be accepted at once, see for example

http://blogs.msdn.com/karstenj/archive/2006/11/15/wcf-calls-hanging-without-any-debug-or-fault-information.aspx

for a description of the relevant service-level throttles, and

http://blogs.msdn.com/drnick/archive/2006/07/05/656684.aspx

to see about MaxPendingConnections at the transport level.






Re: Windows Communication Foundation (Indigo) Concurrency ** Multi Threading Problem

TrevorW

I "blieve" you can also use the good 'ol fashioned technique of using a lock within your workflow.

I.e.

private object syncLock = new object();

//... within area you want to run synchronously:

lock(syncLock) {

// within this area two threads cannot execute asyncronously

//...

}