Skip to content
Sergey Ivasenko edited this page Dec 24, 2015 · 11 revisions

Main Configuration

RouterConfiguration

public class RouterConfiguration
{
    // Internal MessageRouter socket address. Used to connect local ActorHosts and MessageHubs.
    public SocketEndpoint RouterAddress { get; set; }

    // External MessageRouter socket address. Used to connect MessageRouters on other nodes.
    public SocketEndpoint ScaleOutAddress { get; set; }

    // Wait time between MessageRouter establishes connection to another node and starts forwarding messages to it.
    public TimeSpan ConnectionEstablishWaitTime { get; set; }
}

Configuration sample:

var routerConfiguration = new RouterConfiguration
        {
            RouterAddress = new SocketEndpoint("inproc://router"),
            ScaleOutAddress = new SocketEndpoint("tcp://192.168.0.2:5201")
        }

In most cases, for performance reasons internal socket would connect with INPROC protocol. External socket should connect with TCP protocol to other members of the network. If ConnectionEstablishWaitTime is not set, then default value of 200 msec will be used.

ClusterMembershipConfiguration

public class ClusterMembershipConfiguration
{
	// Max timeout of Ping messages, after which the node will do a failover switch to next Rendezvous instance.
	public TimeSpan PingSilenceBeforeRendezvousFailover { get; set; }
	
	// Max timeout of Pong message from a node, after which other nodes will remove it from their ExternalRoutingTable.
	public TimeSpan PongSilenceBeforeRouteDeletion { get; set; }
	
	// True, if MessageRouter will not use Rendezvous discovery and will not connect to other nodes.	
	public bool RunAsStandalone { get; set; }
}

Both PingSilenceBeforeRendezvousFailover and PongSilenceBeforeRouteDeletion should be at least two times longer than the PingInterval defined in RendezvousConfiguration.

RendezvousEndpoint

public class RendezvousEndpoint : IEquatable<RendezvousEndpoint>
{
	public RendezvousEndpoint(string unicastUri, string broadcastUri)
		: this(new Uri(unicastUri), new Uri(broadcastUri))
	{
	}

	// Rendezvous broadcast socket address. Used to receive messages from Rendezvous.
	public Uri BroadcastUri { get; }

	// Rendezvous unicast socket address. Used to send messages to Rendezvous.
	public Uri UnicastUri { get; }
}

Your application should have configuration for all Rendezvous instances, which build up the cluster.

MessageHubConfiguration

public class MessageHubConfiguration
{
	// Internal MessageRouter socket address.
	public Uri RouterUri { get; set; }
}

RouterUri should be set to the same value as RouterConfiguration.RouterAddress. In most cases, communication will be over INPROC protocol.

SocketConfiguration

NetMQ-specific settings. For more details on configuration, please, check API Reference.

public class SocketConfiguration
{
	// The linger period determines how long pending messages which have yet to be sent to a peer shall linger in memory after a socket is closed.
	public TimeSpan Linger { get; set; }
	
	// The high water mark is a hard limit on the maximum number of outstanding messages NetMQ shall queue in memory.
	public int SendingHighWatermark { get; set; }
	
	// The high water mark is a hard limit on the maximum number of outstanding messages NetMQ shall queue in memory.
	public int ReceivingHighWatermark { get; set; }
}

Rendezvous Configuration

ApplicationConfiguration

public class ApplicationConfiguration
{
    // Name under which the Rendezvous will be installed as Windows Service.
    public string ServiceName { get; set; }

    // RendezvousConfiguration see below
    public RendezvousConfiguration Rendezvous { get; set; }

    // SynodConfiguration see below
    public SynodConfiguration Synod { get; set; }

    // LeaseConfiguration see below
    public LeaseConfiguration Lease { get; set; }
}

RendezvousConfiguration

 public class RendezvousConfiguration
{
    // Rendezvous broadcast socket address. Used to send messages to connected MessageRouters.
    public Uri BroadcastUri { get; set; }

    // Rendezvous unicast socket address. Used to receive messages from connected MessageRouters.
    public Uri UnicastUri { get; set; }

    // Ping message send period.
    public TimeSpan PingInterval { get; set; }
}

SynodConfiguration

public class SynodConfiguration
{
    // Node self address used for communication between cluster members.
    public Uri LocalNode { get; set; }

    // Addresses of all nodes, including node self address.
    public IEnumerable<Uri> Members { get; set; }
}

Configuration sample:

var config = new SynodConfiguration
     {
         LocalNode = new Uri("tcp://192.168.0.1:3000"),
         Members = new []
                   {
                       new Uri("tcp://192.168.0.1:3000"),
                       new Uri("tcp://192.168.0.2:3000"),
                       new Uri("tcp://192.168.0.3:3000")
                   }
     }; 

LeaseConfiguration

public class LeaseConfiguration
{
    // Lease validity time.
    public TimeSpan MaxLeaseTimeSpan { get; set; }
    
    // Max clock difference between any nodes of the Rendezvous cluster.
    public TimeSpan ClockDrift { get; set; }
    
    // Max message round trip time.
    public TimeSpan MessageRoundtrip { get; set; }
    
    // Max time to wait for cluster member response.
    public TimeSpan NodeResponseTimeout { get; set; }
}

Configuration parameters should satisfy to the following requirements:

  • NodeResponseTimeout should be less than or equal to half of the MessageRoundtrip time
  • MaxLeaseTimeSpan should be greater than the sum of ClockDrift and doubled MessageRoundtrip time

MaxLeaseTimeSpan should be set as high as possible to reduce the frequency of lease renewals and to give lease owners enough time to execute operations on owned resources. On the other hand, MaxLeaseTimeSpan should be as short enough to ensure that interruptions due to crashed lease owners are kept to a minimum.

Clone this wiki locally