开发者

How to achieve maximum callback throughput with WCF duplex channels

I have setup a basic WCF client/server which are communicating via Named pipes.

It is a duplex contract with a callback. After the client "subscribes", a thread on the server just invokes the callback as quickly as possible.

The problem is I am only getting a throughput of 1000 callbacks p开发者_开发百科er second. And the payload is only an integer!

I need to get closer to 10,000.

Everything is essentially running with default settings.

What can I look at to improve things, or should I just drop WCF for some other technology?

Thanks


While WCF is designed for high throughput and low latency, the scenario you described is pushing the limit. I see a few ways to solve:

One possible solution is to combine multiple packets into one (like 1 List<int> with 10 elements instead of 10 single int). This will drastically reduce performance losses by extra elements (header etc) for small packets.

Another idea is to use asynchronous calls, so latency does not limit throughput. Instead of waiting for the previous packet to arrive, you just send the next packets immediately. This can also be achieved using the OneWayCommunication flag.

Obviously, the underlying data stream format (named pipe, tcp, etc) has an effect on speed as well the the physical channel (ethernet etc). As far as I know, tcp is one of the fastest ways for communication over network and still extremely fast on the local machine.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜