开发者

WCF - factories and channel objects - how to create for better performance

开发者 https://www.devze.com 2023-02-23 13:19 出处:网络
I just want to make sure I\'m following the right approach. In my application for particular 开发者_Go百科service I have one static ChannelFactory (as it\'s instance thread safe), and every time I nee

I just want to make sure I'm following the right approach. In my application for particular 开发者_Go百科service I have one static ChannelFactory (as it's instance thread safe), and every time I need to comunicate with WCF Service I create a channel with CreateChannel , use that channel and then close it. However I bumped into one opinion that storing channel itself in static member, and reusing it is also right (author of that opinion also claims that creation of channels on PerCall basis will decrease performance significantly). What's the best approach?

Thanks,Pawel


Well I suggest you do your own performance testing, but I think you'll find that with your approach you won't have any problem creating many thousands of channels per second depending on your hardware. In my opinion for most use cases it won't matter much at all.

If you are interested, Michele Bustamante (from IDesign.net) goes into the discussion here with code samples.

0

精彩评论

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