Working WCF WebServices with NLB server

load balancingnetworkingwcf

Im starting the architecture of a new project using WCF, but im not the right person to make some network considerations, so im doing some research but cannot find the answers to these questions:

  1. We´ll host the WCF service in a common Windows Service app in 2 servers and we´ll have another server to make the Load-Balancing job using the WNLB. The fact that we are hosting the WCF in a Windows Service app can disturb the NLB job?

  2. Before my research i thought the load balancing was tought to configure, but with NLB it seems to be very simple, its really that simple?

Note: The binding will be basicHttpBinding

Best Answer

I can't speak to NLB specifically with regards to load balancing WCF services, but I've supported and built out many load balanced WCF web services in the past. Overall, I wouldn't recommend using NLB, outside of a Dev environment, as NLB does not scale well. However, if you don't have access to a hardware load balancer or the desire to get into Linux (HAProxy/Varnish/Nginx), it can work.

So:

  1. No, NLB should have no problem load balancing a WCF web service.
  2. NLB is simpler to configure, as it has less capabilities than a more robust load balancing solution. It is what it is. There are plenty of options that you can still make use of, including rewriting, but NLB is not a very fully featured load balancing solution.

The only caveat that I have to any of this is more to do with load balancing WCF than with NLB. If you plan on using SSL with your WCF service, and you transition to a load balancer that supports SSL-offloading, you may run into issues with the WSDL not being available through the VIP (virtual server IP address). There are workarounds, but since you're not there yet, I just wanted to make you aware of it, not freak you out.

EDIT: I was going to elaborate on how to address metadata in an SSL-offload scenario, but a recent MSDN blog post handles it much more elegantly:

http://blogs.msdn.com/b/dsnotes/archive/2014/10/03/ssl-offloading-in-load-balancer-scenario.aspx

The gist is that there are two options, modifying the customBinding to allow enableUnsecuredResponse or to modify the WSDL completely to make it available over HTTPS on the server. Option 2 is the more effective way to handle this, as it will allow for better compatibility with non .NET technologies.