// Collection of code snippets by Arne Vajhøj // (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) using System; using Infinispan.HotRod; using Infinispan.HotRod.Config; namespace InfinispanPerformance { public class Program { private const int N = 10000; private static void Test(IRemoteCache 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) { ConfigurationBuilder b = new ConfigurationBuilder(); b.AddServer().Host("localhost").Port(11222); RemoteCacheManager rcm = new RemoteCacheManager(b.Build()); IRemoteCache cache = rcm.GetCache("performance_cache"); for (int i = 0; i < REP; i++) { Test(cache); } rcm.Stop(); } } }