Thursday, December 3, 2009

Clusters: Multicast or Broadcast?


 So What are the advantages of using Multicast vs. Broadcast for cluster communications?

Multicast and broadcast are nearly identical.  Both are UDP datagram based.  The advantages that multicast has over broadcast are that multicast can span multiple subnets (presuming that the intervening routers are configured correctly) and that with broadcast only one application can receive a datagram.

Most configurations do not use multicasting over multiple subnets.  Clusters are nearly universally on the same subnet.  So the ability for multicast to span subnets is rarely, if ever, used.  The ability for more than one application to receive a UDP datagram is an important feature.  In fact, multicasting is the only way under IP to have a datagram/packet delivered to multiple applications. 

For example, you could have a cluster configured and the cluster is managed by exchanging UDP multicast datagrams.  An application that monitored the cluster and needed those same datagrams could run on one of the cluster nodes and two applications would receive the datagrams.  With broadcasting, a monitoring application could not run on a node in the cluster as only the cluster manager would be able to receive the datagrams.

As previously mentioned, for a cluster monitoring application with broadcasting, the monitor would be required to run on the same subnet as the cluster.  With multicasting, it would be possible to run the monitoring application on a different subnet than the cluster.

The bottom line is that for the condition of a single subnet, broadcast and multicast are nearly identical.  The sole benefit being multicast supports multiple delivery, and this feature may be needed based the applications that are deployed.