服务器架构问题。 (WCF+NServiceBus)
首先我将描述当前状态:
服务器由多个 WCF 服务组成,托管在不同计算机上的一个或多个 win 服务中。
- 负责从不同设备接收数据的服务。与设备的通信是使用套接字实现的。服务实例模式——单例。
- 数据代理服务 - 负责保存数据并按请求共享。实例模式——单例。
- 配置服务 - 负责更改配置数据库并使用管理控制台(WPF 应用程序,如 SSMS)。处理来自控制台、订户管理等的连接。实例模式 - 单例。
- 客户端访问服务 - 与上面的客户端管理完全相同,但也通知客户端新数据,并且充当服务总线的外观。又单身了。
- 身份管理服务 - 检查权限并返回结果。辛格尔顿。
所有这些服务都与 NServiceBus 连接,我真的很喜欢它此时的工作方式。
但是:
单身人士太多了。主要是因为要使用 servicebus 我必须有它的单个实例。我不知道也许我可以在会话模式下使用 nservice 总线,但不知道如何处理所有这些服务都将使用一个队列的问题。
如果我有 300 多个客户怎么办?单身人士可能会变得反应迟钝..
我想就这一切征求一些批评者的意见,也许有人可以提出一些建议。
提前致谢。
阿列克谢
First of all i will describe current state:
Server consists of several WCF services, hosted in one or several win services on diffirent machines.
- Service responsible for recieving data from diffirent devices. Communication with devices is implemented using sockets. Service instance mode - singleton.
- Data broker service - responsible for persisting data and sharing in by request. Instance mode - singleton.
- Configuration service - responsible for changing configuration database and working with administration console(WPF app, like SSMS). Handles connections from console, subscriber management, etc. Instance mode - singleton.
- Client access service - quite the same as above thith management of clients but also notifyes clients of new data, and acts like facade to service bus. And singleton again.
- Identity management service - Checks permissions and returns result. Singleton.
All of those services are connected with NServiceBus and i realy like how it works at this moment.
But:
Too many singletons. Mainly because to use servicebus i must have single instance of it afaik. I dunno maybe i can use nservice bus in session mode, but dont know how to handle issue that all of those services will use one queue.
And what if i will have 300+ clients? singleton can become unresponsive..
And i wanted to ask for some critics about all of this and maybe some one could suggest something.
Thanks in advance.
Alexey
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Alexey,
虽然每个进程应该只有一个总线实例,但您可以将该实例放在全局可访问的位置(如 AsyncPages 示例中所示),并从非单例对象(如网页和 WCF 服务)使用该实例。
此外,让所有服务都使用一个队列可能并不合适。如果没有更好地了解您的情况,我会为您确定的每一项服务提供一个队列的默认建议。
希望有帮助。
Alexey,
While you should only have one instance of the bus per process, you can put that instance in a globally accessible place (as shown in the AsyncPages sample), and use that from non-singleton objects like web pages and WCF services.
Also, it is probably not appropriate to have all your services using one queue. Without better understanding your situation, I'd give the default recommendation of one queue for each of the services you identified.
Hope that helps.