Apache Ignite.NET Documentation

The Apache Ignite .NET Developer Hub

Welcome to the Apache Ignite .NET developer hub. You'll find comprehensive guides and documentation to help you start working with Apache Ignite.NET as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Cluster Groups

Easily create logical groups of cluster nodes within your cluster.

IClusterGroup represents a logical grouping of cluster nodes.

In Ignite .NET all nodes are equal by design, so you don't have to start any nodes in specific order, or assign any specific roles to them. However, Ignite allows users to logically group cluster nodes for any application specific purpose. For example, you may wish to deploy a service only on remote nodes, or assign a role of "worker" to some worker nodes for job execution.

👍

Note that ICluster interface is also a cluster group which includes all nodes in the cluster.

You can limit job execution, service deployment, messaging, events, and other tasks to run only within some cluster group. For example, here is how to broadcast a job only to remote nodes (excluding the local node).

IIgnite ignite = Ignition.Start();

ICluster cluster = ignite.GetCluster();

// Get compute instance which will only execute
// over remote nodes, i.e. not this node.
ICompute compute = ignite.GetCompute(cluster.ForRemotes());

// Broadcast to all remote nodes and print the ID of the node 
// on which this closure is executing.
compute.Broadcast(new MyComputeAction());

Predefined Cluster Groups

You can create cluster groups based on any predicate. For convenience Ignite comes with some predefined cluster groups.

Here are examples of some cluster groups available on ClusterGroup interface.

ICluster cluster = ignite.GetCluster();

// Cluster group with remote nodes, i.e. other than this node.
IClusterGroup remoteGroup = cluster.ForRemotes();
ICluster cluster = ignite.GetCluster();

// All nodes on which cache with name "myCache" is deployed,
// either in client or server mode.
IClusterGroup cacheGroup = cluster.ForCacheNodes("myCache");

// All data nodes responsible for caching data for "myCache".
IClusterGroup dataGroup = cluster.ForDataNodes("myCache");

// All client nodes that access "myCache".
IClusterGroup clientGroup = cluster.ForClientNodes("myCache");
ICluster cluster = ignite.GetCluster();

// All nodes with attribute "ROLE" equal to "worker".
IClusterGroup attrGroup = cluster.ForAttribute("ROLE", "worker");
ICluster cluster = ignite.GetCluster();

// Pick a remote node.
IClusterNode remoteNode = cluster.ForRemotes().GetNode();

// All nodes on the same physical host as the remote node.
IClusterGroup sameHost = cluster.forHost(remoteNode);
ICluster cluster = ignite.GetCluster();

// Dynamic cluster group representing the oldest cluster node.
// Will automatically shift to the next oldest, if the oldest
// node crashes.
IClusterGroup oldestNode = cluster.ForOldest();
ICluster cluster = ignite.GetCluster();

// Cluster group with only this (local) node in it.
IClusterGroup localGroup = cluster.ForLocal();

// Local node.
IClusterNode localNode = localGroup.GetNode();

Custom Cluster Groups

You can define dynamic cluster groups based on some predicate. Such cluster groups will always only include the nodes that pass the predicate.

Here is an example of a cluster group over nodes that have less than 50% CPU utilization. Note that the nodes in this group will change over time based on their CPU load.

ICluster cluster = ignite.GetCluster();

// Nodes with less than 50% CPU load.
IClusterGroup readyNodes = _grid1.GetCluster().ForPredicate(node => node.GetMetrics().CurrentCpuLoad < 0.5);

Getting Nodes from Cluster Groups

You can get to various cluster group nodes as follows:

IClusterGroup remoteGroup = cluster.ForRemotes();

// All cluster nodes in the group.
ICollection<IClusterNode> grpNodes = remoteGroup.GetNodes();

// First node in the group (useful for groups with one node).
IClusterNode node = remoteGroup.GetNode();

// And if you know a node ID, get node by ID.
Guid myID = ...;

node = remoteGroup.GetNode(myId);

Cluster Group Metrics

Ignite automatically collects metrics about all the cluster nodes. The cool thing about cluster groups is that it automatically aggregates the metrics across all the nodes in the group and provides proper averages, mins, and maxes within the group.

Group metrics are available via IClusterMetrics interface which contains over 50 various metrics (note that the same metrics are available for individual cluster nodes as well).

Here is an example of getting some metrics, including average CPU load and used heap, across all remote nodes:

// Cluster group with remote nodes, i.e. other than this node.
IClusterGroup remoteGroup = ignite.GetCluster().ForRemotes();

// Cluster group metrics.
IClusterMetrics metrics = remoteGroup.GetMetrics();

// Get some metric values.
double cpuLoad = metrics.CurrentCpuLoad;
long usedHeap = metrics.HeapMemoryUsed;
int numberOfCores = metrics.TotalCpus;
int activeJobs = metrics.CurrentActiveJobs;

Updated less than a minute ago

Cluster Groups


Easily create logical groups of cluster nodes within your cluster.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.