Benefits of using MS Queue
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 S开发者_JAVA技巧OAP style web methods. There is also a possibility, looking to the future, that there may be multiple web servers.
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 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.
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.
精彩评论