Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load Balance WCF and Share a Remote MSMQ for High Throughput

After a ton of reading in books and on the web, I have noticed hints of information that WCF and MSMQ can be used in achieving high throughput. The information I have seen mentions using multiple WCF services in a farm that reads from a single MSMQ queue. The problem is that I have found paragraphs here and there that mentions that high throughput can be done, but I cannot seem to find a document of how to implement it. The following is an excerpt from a MSDN article.

The following paragraph is from Best Practices for Queued Communication http://msdn.microsoft.com/en-us/library/ms731093.aspx To achieve higher throughput and availability, use a farm of WCF services that read from the queue. This requires that all of these services expose the same contract on the same endpoint. The farm approach works best for applications that have high production rates of messages because it enables a number of services to all read from the same queue.

This is what I'm trying to solve. I have an intranet application where a client sends a request to a WCF service. But I want the ability to load balance the WCF services on multiple servers in a farm. I also want these WCF services in the farm to do transactional reads from a remote MSMQ when an item is available in the Queue. If this is possible, an issue I have is that I do not understand the activation process of WCF to retrieve messages from a remote queue.

If this is possible, does anyone know of any articles or Webcasts that would explain it in detail?

BarDev

like image 812
Mike Barlow - BarDev Avatar asked Mar 31 '10 17:03

Mike Barlow - BarDev


1 Answers

I dont know about any articles but as a proof of concept, I ran multiple instances of an existing wcf application against an msmq.

What happened was that if 10 messages where already present in the queue, they were handled by only one of the wcf instance.

However all the subsequent messages that were posted onto the queue where divided almost equally between all the wcf instances providing a pretty neat load balancing solution.

What you need to do is to create a single wcf service running against an msmq, make sure that its working properly, and then go from there by running more and more instances of the wcf service to see what is happening

like image 151
shake Avatar answered Nov 09 '22 22:11

shake