📜 ⬆️ ⬇️

Apache Ignite.NET 2.4: Slim and Cross Platform

Recently a new version of Apache Ignite distributed SQL database has been released, I suggest to look at the new features from the position of .NET.


Ignite cluster


Thin .NET Client


Prior to version 2.4 in both Java and .NET , there were two options for connecting to a cluster: Server and Client. In general, client mode differs from server mode only in that client nodes do not store data and do not perform calculations (compute, map-reduce). Otherwise, existing discovery & communitaction components are reused. Attaching a client node to a cluster is a relatively heavy process that can take several seconds.


The situation with .NET is complicated by the fact that the JVM starts inside the process, consuming a lot of resources and introducing additional requirements to the environment.


All these problems are solved by our new “thin” client :



There is only Cache + LINQ so far from the functionality, in the future we plan to add everything else.
The API looks identical:


var cfg = new IgniteClientConfiguration { Host = "127.0.0.1" }; using (var client = Ignition.StartClient(cfg)) { var cache = client.GetCache<int, Person>("persons"); cache[1] = new Person(1, "Vasya"); cache[2] = new Person(2, "Petya"); // SQL cache.Query(new SqlFieldsQuery("select name from person where id > 1")); // LINQ cache.AsCacheQueryable().Where(x => x.Value.Id > 1) ...; } 

It should be noted that the appearance of a thin client does not mean at all that the existing “fat” API will be sent to a landfill in the future:



Example in LINQPad
In the process of working with Ignite, you may want to quickly connect to the cluster, look at the data in the caches, run some query. To do this, there are tools such as the Visor Command Line and the Web Console .


With the advent of the thin client, all this can be quickly and conveniently done through LINQPad . Just add the NuGet Apache.Ignite package via "Add NuGet ...", and the finished sample code will be loaded automatically.


Screenshot

Ignite.NET Thin Client LINQPad Sample


.NET Core, Mono, Linux, macOS


Ignite.NET in Visual Studio Code on macOS


The title speaks for itself; now Ignite.NET can be used on the following platforms and operating systems:



How to try?
Under the .NET Core instruction is the same for all platforms:



warning NU1701: This package may not be fully compatible with your project.

The project warning NU1701: Package 'Apache.Ignite 2.4.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project. will issue a warning warning NU1701: Package 'Apache.Ignite 2.4.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project. warning NU1701: Package 'Apache.Ignite 2.4.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.


The reason is that inside the NuGet package there is a single dll compiled under .NET 4.0, which is done to simplify the process. This does not prevent her from working under .NET Core. You can suppress a warning using the <PropertyGroup><NoWarn>NU1701</NoWarn></PropertyGroup> in the csproj .


Mono
Mono works with ordinary 'Classic .NET' solutions, you can create them on Linux in MonoDevelop .


One of the mono case for Mono is 32-bit processors, because .NET Core requires x64. I ran into this by testing the launch of Ignite.NET on everything that came hand in hand, and the old EEE PC 901 from the installed Lubuntu , where everything started up safely under Mono, came to hand.


Linux and macOS Development
In addition to use, Ignite.NET can now also be developed on Linux and macOS. Under Mono, the basic solution is compiled as is. Under .NET Core for this purpose, separate solitary files and projects under .NET Core are added:
Apache.Ignite.DotNetCore.sln .


Conclusion


Ignite.NET now covers all major platforms and operating systems. One of the popular use cases that has become possible is a cluster of .NET nodes running on Linux and client applications running through the thin protocol on Windows workstations.


Further development of the .NET Core direction is planned: integration with ASP.NET Core (caching) and Entity Framework Core (caching, data provider). Such integrations already exist for classic ASP.NET and EF.


')

Source: https://habr.com/ru/post/347374/


All Articles