WCF耐用服务是正确的选择吗? [英] Is WCF Durable Services the right choice?

查看:74
本文介绍了WCF耐用服务是正确的选择吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在选择在WCF会话/呼叫之间保存状态的最佳方法.我们发现WCF DurableService 适合我们的需求.

We are in the process of selecting the best method for saving state between WCF sessions/calls. We have found that WCF DurableService suits our needs.

我们想知道这对于大量使用是可以的.我们预计将有1000多个会话,并且每个会话将持久存储大约100KB的数据(xml序列化格式),而复杂对象(仅1个对象)将被持久保存.

We would like to know is this ok for heavy usage. We are expecting 1000+ sessions and each session will be persisting about 100KB of data (xml serialized format), with complex object (only 1 object) to be persisted.

鉴于我们的要求,WCF DurableServices是正确的解决方案吗?

Given our requirements, is WCF DurableServices the right solution?

推荐答案

DurableService使用内置的WCF功能通过BasicHttpContextBinding或WSHttpContextBinding将状态(模块级变量)传达给客户端.持久性机制取决于客户端上的HTTP cookie或soap标头,以存储调用之间的序列化数据.您的平均肥皂消息大小为100KB,再加上操作参数在每次调用中保留的有效负载.您还必须在操作合同和应用程序逻辑中设计CanCreateInstance和CompleteInstance语义,以正确删除会话有效负载.

DurableService uses built-in WCF features to communicate the state (module-level variables) to the client using either the BasicHttpContextBinding or the WSHttpContextBinding. The persistence mechanism depends on either HTTP cookies on the client or soap headers for storing the serialized data between calls. Your average soap message size would be 100KB plus whatever payload the operation parameters hold on each call. You also have to design CanCreateInstance and CompleteInstance semantics into your operations contracts and application logic to properly remove the session payload.

DurableService很有可能表现不佳.默认情况下,启用任何类型的会话的WCF服务仅限于16个并发会话.您可以增加该数目,但是我怀疑您是否可以在单个服务器实例上处理1000多个会话.对于这么多会话,您可能需要为多个主机服务器使用基于硬件或软件的负载均衡器,即使使用所谓的会话亲和力支持,也使得在生产中维护会话变得困难.我建议使用无状态每次通话服务设计,并使应用程序代码负责管理状态.

DurableService most likely isn't going to be very performant given your scenario of 1000+ concurrent session and 100KB of session data. By default, WCF services that enable session of any kind are limited to 16 concurrent sessions. You can increase that number but I doubt you'll be able to handle 1000+ sessions on a single server instance. For that many sessions you'll likely need to use either a hardware or software based load balancer for multiple host servers which makes maintaining session iffy in production even with so-called session affinity support. I'd recommend using a stateless per call service design and make the application code responsible for managing state.

这篇关于WCF耐用服务是正确的选择吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆