Service Grid

Service Grid allows for deployments of arbitrary user-defined services on the cluster. You can implement and deploy any service, such as custom counters, ID generators, hierarchical maps, etc.

The main use case of the service grid is ability to deploy various types of singleton services in the cluster. However, in case if you need multiple instances of a service, Ignite will also ensure proper deployment and fault tolerance of all service instances.

Code Examples:
                            // Simple service implementation.
                            public class MyIgniteService implements Service {
                                // Example of ignite resource injection. All resources are optional.
                                // You should inject resources only as needed.
                                @IgniteInstanceResource
                                private Ignite ignite;
                                ...

                                @Override public void cancel(ServiceContext ctx) {
                                    // No-op.
                                }

                                @Override public void execute(ServiceContext ctx) {
                                    // Loop until service is cancelled.
                                    while (!ctx.isCancelled()) {
                                        // Do something.
                                        ...
                                    }
                                }
                            }
                        
                            Ignite ignite = Ignition.ignite();

                            IgniteServices svcs = ignite.services();

                            // Deploy cluster-singleton service.
                            svcs.deployClusterSingleton("myClusterSingleton", new MyIgniteService());
                        
GitHub Examples:

Also see service grid examples available on GitHub.

Service Grid Features

Feature Description
User-Defined Services

Users can define their own services and Ignite will automatically distribute these services over the cluster. For example, you can create your own specialized distributed counters, or a custom data loading service, or any other logic, and deploy it onto the cluster.

Cluster Singletons

Ignite allows to deploy any number of services on any of the grid nodes. However, the most commonly used feature is to deploy singleton services on the cluster. Ignite will manage the singleton contract regardless of topology changes and node crashes.

Fault Tolerance

Ignite always guarantees that services are continuously available, and are deployed according to the specified configuration, regardless of any topology changes or node crashes.

Load Balancing

In all cases, other than singleton service deployment, Ignite will automatically make sure that about an equal number of services are deployed on each node within the cluster. Whenever cluster topology changes, Ignite will re-evaluate service deployments and may re-deploy an already deployed service on another node for better load balancing.