开发者

WCF call order in single concurrency mode

开发者 https://www.devze.com 2023-03-30 17:03 出处:网络
Assume a WCF service with ServiceBehavior.ConcurrencyMode = Single. When exactly does the service start b开发者_如何学运维locking for concurrent calls?

Assume a WCF service with ServiceBehavior.ConcurrencyMode = Single.

When exactly does the service start b开发者_如何学运维locking for concurrent calls?

For example, say we have two clients: Slow and Fast.

At time 0 Slow starts a slow service call that includes a huge chunk of data.
At time 1 Fast makes a fast service call.
At time 2 the slow data finally arrives and the service code is executed on the server.

Assuming buffers configured in WCF to be larger than the huge chunk, which call will get executed first?

In other words, does blocking start when all call data has been received at the server side or when the client initiates the call?

Is the service blocked during the data transfer or only during code execution?


Unless you configure InstanceContextMode to Single as well both calls will be executed concurrently. So suppose that you have InstanceContextMode set to Single.

I didn't test it but I would expect such behavior. Concurrency mode is service behavior so it takes place once the service instance / instance context is resolved. In buffered mode that happens after whole message is received in streaming mode it should happen after message headers are received. So in case of buffered transport I would expect that fast client will be processed first and in case of streamed transport it depends if message headers from slow client was already received.

But as I wrote before this is only my expectation.

0

精彩评论

暂无评论...
验证码 换一张
取 消