Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Getting Started With Apache Ignite.NET: Part 1

DZone's Guide to

Getting Started With Apache Ignite.NET: Part 1

This post opens a blog series about Apache Ignite.NET, distributed in-memory platform. We are going to start from the basics, and work our way up to implement a simple fully-functional social network site in a distributed and automatically scalable fashion.

· Big Data Zone
Free Resource

Need to build an application around your data? Learn more about dataflow programming for rapid development and greater creativity. 

This post opens a blog series about Apache Ignite.NET, distributed in-memory platform.

ignite logo

We are going to start from the basics, and work our way up to implement a simple fully-functional social network site in a distributed and automatically scalable fashion.

What Exactly Is Apache Ignite?

Ignite is a framework for building distributed applications that run on multiple machines, share data and computing power. Properly built distributed applications can be scaled out easily.

Our first step is to start a cluster locally and see how Ignite nodes connect to each other.

Terminology

  • Ignite Node: An instance produced by one of the Ignition.Start* methods. There can be multiple nodes per machine or even per process.
  • Cluster, Topology: A set of interconnected nodes. There can be multiple separate clusters on the same machine, or even in the same procesee.
  • Server: Ignite Node running in server mode (default mode)
  • Client: Ignite Node running in client mode (IgniteConfiguration.ClientMode = true)

Prerequisites

We are going to need Visual Studio (2010+ will do) and Java.

Yes, Java. Ignite.NET is built on top of Ignite, which needs JRE to run. Don’t worry, we are not going to deal with it in any way directly, it is just needed at runtime.

First Ignite.NET Application

Let’s get to the coding. Open up Visual Studio and create a new Console Application (.NET 4+). We are going to use console a lot during our first steps to better observe how the clustering works. Make sure to disable “Prefer 32-bit” option in the project settings so that your app runs in x64 mode on x64 OS and works with installed JRE:

Disable Prefer 32-bit

Next, install the Ignite NuGet package. In the Package Manager Console:

Install-Package Apache.Ignite

Import Apache.Ignite.Core namespace, add Ignition.Start() to the Main method, and our distributed application is done!

using System;
using Apache.Ignite.Core;

class Program
{
    static void Main(string[] args)
    {
        Ignition.Start();
        Console.ReadKey(); // keep the node running     }
}

Start the program and observe the console output. In particular, we are interested in the following line:

[17:35:33] Topology snapshot [ver=1, servers=1, clients=0, CPUs=8, heap=1.8GB]

We can see that there is one server node in the cluster.

Do not close the running app and start it once again (use Ctrl-F5 in Visual Studio to run without a debugger). You should see how two applications connect to each other:

[17:41:35] Topology snapshot [ver=2, servers=2, clients=0, CPUs=8, heap=3.5GB]

cosole output

Close one of the nodes. In a moment, remaining node will detect that another one has disconnected, and report another topology change:

[17:44:12] Topology snapshot [ver=3, servers=1, clients=0, CPUs=8, heap=1.8GB]

You can start as many nodes as you want, locally or on multiple machines within the same network (don’t forget about firewalls though).

Next time: working with distributed cache.

Check out the Exaptive data application Studio. Technology agnostic. No glue code. Use what you know and rely on the community for what you don't. Try the community version.

Topics:
apache ignite

Published at DZone with permission of Pavel Tupitsyn. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}