How many threads does ConcurrencyMode.Multiple allow?

Hello everybody

I've written a service which uses ConcurrencyMode.Multipe and InstanceContextMode.Single. A test application consecutively calls the same operation of my service a 1000 times. The service adds the data which is passed to the web method into a queue from where every item is dequeued every 5 seconds. This should result to a queue which contains about 1000 items at the beginning, then decreasing every 5 seconds.

Unfortunately the queue only contains at most about 12-15 items. It seems the web service is blocking all the other calls until the threads of previous calls have been finished.

Any ideas what's the problem here? Could this have something to do with the buffer size setting? Or is the buffer size per call and not for all calls together?

How can I call as much web methods as I like?

Kind regards

[879 byte] By [ParkerLewis] at [2007-12-30]
# 1

My first question would be do you need to use ConcurrencyMode.Multiple?

ConcurrencyMode.Multiple does not put client messages in a que, and there are no syncrhonization locks. So just because you are making a 1000 calls to the service, does not mean the service is going to execute 1000 times.

The default max concurrent calls is 16 - it was previously 64. If you want to use this I am pretty sure you are going to have to implement your own locking mechanism - which can be painful.

If you use ConcurrencyMode.Single the locking will be provided for you and your service will execute with every client call (1000 times)

If you are concerned with calling out to another service and not locking up the calling service you should look at ConcurrencyMode.Reetrant.

Mike

MichaelOlivieri at 2007-9-5 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 2

Hello Mike

Thank you for your answer. Yes, I need to use the ConcurrencyMode.Multiple. I know that the client messages are not put into a queue automatically. The queue I talked about is a queue I've manually implemented in the service and yes, I have also manually implemented a locking mechanism.

You say, the default max conccurent calls is 16. You're talking about a default value - does this mean I can increase this number somewhere? If not, why isn't it possible to call a web method 1000 times concurrently with ConcurrencyMode.Multiple, but it's possible with ConcurrencyMode.Single (as you said)? Is there any reason for this?

If I call the web method 1000 times in ConcurrencyMode.Multiple and the max concurrent calls is 16 as you said, does this mean that my 1000 calls are processed consecutively in 16-level steps? Or does the service only process the first 16 calls and the rest is ignored?

Kind regards

ParkerLewis at 2007-9-5 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 4

Hey Parker,

Can you post your synchronization code?

Mike

MichaelOlivieri at 2007-9-5 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 5

Thank you, Leonardo. This helps a lot. Is there an upper limit for the MaxConcurrentCalls property?

I hope ServiceThrottle does not mean only throttling (decreasing) the value, but also increasing it.

Kind regards

ParkerLewis at 2007-9-5 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 6

Hey Michael

Unfortunately the synchronization code is spread over different classes - it's part of a business application and not as simple as an object lesson.

Do you have any suspicion regarding the ConcurrentMode.Multiple behaviour or do you need the sync code for a similar problem?

Best wishes

ParkerLewis at 2007-9-5 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 7

Parker,

I do have a suspician that your synchronization code is not implemented correctly. There is a specific way you need to code the manual synchronization in order to use ConcurrentMode.Multiple with a singleton object.

If you could describe the way your are handling I may be able to offer assistance.

MichaelOlivieri at 2007-9-5 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 8

Hello Michael

Sorry for my late response. Unfortunately I wasn't fully involved when the synchronization code has been imlpemented but could you tell me the vertices resp. the key positions of that "specific way" to implement the sync mechanism. What sould we attend? Does the sync code of a service must work differently than in other multi-threading scenarios?

Kind regards

ParkerLewis at 2007-9-5 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...

Visual Studio Orcas

Site Classified