// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using System.Collections.Generic; using Apache.Ignite.Core; using Apache.Ignite.Core.Client; using Apache.Ignite.Core.Client.Cache; namespace cache.IgniteThin.Performance { public class Program { private const int N = 10000; private static void Test(ICacheClient cache) { // put speed DateTime dt1 = DateTime.Now; for(int i = 0; i < N; i++) { cache.Put("K#" + (i + 1), i + 1); } DateTime dt2 = DateTime.Now; Console.WriteLine("{0} puts per second", N * 1000 / (int)((dt2 - dt1).TotalMilliseconds)); } private const int REP = 5; public static void Main(string[] args) { IgniteClientConfiguration cfg = new IgniteClientConfiguration { Endpoints = new List { "localhost:10800" } }; using (IIgniteClient cli = Ignition.StartClient(cfg)) { ICacheClient cache = cli.GetOrCreateCache("performance_cache"); for(int i = 0; i < REP; i++) { Test(cache); } } } } }