使用 MS 队列的好处
使用 MSMQ 之类的东西如何有助于提高可扩展性和可靠性? 在一台 Web 服务器到一台数据库服务器的情况下,它有帮助吗?
任何评论或链接将不胜感激。 谢谢
编辑: Web 服务器将运行公开 SOAP 样式 Web 方法的 WCF。展望未来,也有可能存在多个 Web 服务器。
How can using something like MSMQ help with scalability and reliability?
In the scenario of one web server to one database server does it help at all?
Any comments or links would be greatly appreciated.
Thanks
EDIT:
The web server will be running WCF exposing SOAP style web methods. There is also a possibility, looking to the future, that there may be multiple web servers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
队列(尤其是容错队列和持久队列)允许组件之间进行通信,并最终允许队列写入者与读取者异步。这意味着读取器和写入器可以根据队列利用率进行扩展。
考虑服务 Web 请求的简单示例。如果将繁重的操作推送到队列上,则另一组组件可以读取队列并处理请求,而不会影响写入器,从而允许 HTTP 侦听器为更多请求提供服务,因为它没有被占用。随着队列中物品数量的增加,可以让更多的读者在线处理它们。
就可靠性而言,如果队列可靠,则组件之间的消息不会丢失,因此通信本质上更可靠。读者和作者可能会上下波动,但只要消息是安全的,那么您就拥有了比消息可能丢失的系统更可靠的系统的基础。
实际上,您正在创建一个运行时耦合较低的系统,因此某一点的故障不一定会在系统范围内传播。允许更成功地采用容错策略。
Queues (especially fault tolerant and persistent queues) allow communication between components and ultimately allow queue writers to be asynchronous to readers. This means that readers and writers can be scaled up depending on queue utilisation.
Consider the simple example of servicing web requests. If a heavy operation is pushed onto the queue another set of components can read the queue and handle the request without the writer being impacted and thus allow the HTTP listener to service more requests as it's not tied up. As the number of items in the queue increases more readers can be brought on line to handle them.
In terms of reliability if the queue is reliable then messages between components are not lost, thus communication is inherently more reliable. The readers and writers may go up and down but as long as the messages are safe, then you have the basis for a more reliable system than one where messages can be lost.
In effect you're create a systems with lower run time coupling, and thus failure at one point doesn't necessarily propagate system wide. Allowing fault tolerance strategies to be employed more successfully.
与数据库通信的 Web 服务器看起来不像 MSMQ 可以从中受益的场景。
但是,如果您有 Web 服务器、域服务器和数据库服务器,那么一切就不同了。在这种情况下,Web 服务器可以通过 MSMQ 与域服务器进行通信(保证交付并以事务方式 - 可靠性)。当您引入额外的 Web 服务器时,架构不会发生任何变化,因此可以实现可扩展性。
阅读有关 CQRS 的内容总是有好处的。
Web server talking to a database does not look like a scenario in which MSMQ can be benefited from.
However if you had web server, domain server and database server then it's all different. In such case web server can communicate with domain server via MSMQ (with guaranteed delivery and in transactional fashion - reliability). When you introduce additional web servers the architecture won't change a bit so scalability is achieved.
Always good to read about CQRS.
是的,如果您需要异步处理并合理保证放置在队列中的任务将被执行,那么 1 个 Web/数据库服务器场景是有价值的。它不提供高可用性(运行 MSMQ 的服务器可能会发生故障等)。
如果您需要更多信息,请提供特定于实施的详细信息。
Yes, there is value in a 1 web/database server scenario, if you need asynchronous processing and a reasonable guarantee that the tasks placed on the queue will be performed. It doesn't provide high availability (the server running MSMQ could fail, among other things).
Provide implementation-specific details if you want more information.