WCF is slow when reliable session is ON and with burst async request

别来无恙 提交于 2019-11-29 08:26:33

You are sending messages Async, but you have ordered="true" on the ReliableSessionBindingElement. This doesn't make sense. Set ordered to false, since it makes more sense for your scenario. ReliableMessaging will cause a performance hit because it adds to every response message a SequenceAcknowledgement. It also adds overhead of CreateSequence/CreateSequenceResponse and CloseSequence/CloseSequenceResponse, then TerminateSequence/TerminateSequenceResponse message exchanges at the beginning and end of your session.

Found a partial workaround for the problem from the below links:

With the workaround (using the WorkerThreadPoolBehavior), the measured throughputs are as follows:

  1. Async + NetTcpBinding/Reliable throughput -> 474 call/s (2.1 ms/call) ... improved but not satisfactorily
  2. Async + WsHttp/Reliable throughput -> 7856 call/s (0.13 ms/call) ... no change
  3. Sync + NetTcpBinding/Reliable throughtput -> 2110 call/s 0.47 ms/call) ... degraded

Note that the case 1 above is improved significantly from 70 ms/call. However, it still lags from case 2. And for case 3, introducing WorkerThreadPool behavior cause performance degradation from 0.25 ms/call to 0.47 ms/call.

Look at this...

"Setting MaxTransferWindowSize

Reliable sessions in Windows Communication Foundation (WCF) use a transfer window to hold messages on the client and service. The configurable property MaxTransferWindowSize indicates how many messages the transfer window can hold.

On the sender, this indicates how many messages the transfer window can hold while waiting for acknowledgements; on the receiver it indicates how many messages to buffer for the service..."

Source "MSDN: Best Practices for Reliable Sessions": http://msdn.microsoft.com/en-us/library/ms733795.aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!