Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F001B200D5E for ; Fri, 8 Dec 2017 09:34:35 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id EE8C8160C27; Fri, 8 Dec 2017 08:34:35 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D48A4160C2C for ; Fri, 8 Dec 2017 09:34:34 +0100 (CET) Received: (qmail 15167 invoked by uid 500); 8 Dec 2017 08:34:34 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 14748 invoked by uid 99); 8 Dec 2017 08:34:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Dec 2017 08:34:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C1082F617E; Fri, 8 Dec 2017 08:34:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Fri, 08 Dec 2017 08:34:49 -0000 Message-Id: <941eac5305e0475882d7c4b89b463d5c@git.apache.org> In-Reply-To: <21903b599650491085e7c473f4d14d7c@git.apache.org> References: <21903b599650491085e7c473f4d14d7c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [18/30] ignite git commit: IGNITE-7124 .NET: Thin client: Cache benchmark archived-at: Fri, 08 Dec 2017 08:34:36 -0000 IGNITE-7124 .NET: Thin client: Cache benchmark Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9813c626 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9813c626 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9813c626 Branch: refs/heads/ignite-zk Commit: 9813c626b3ac49e99d8b404aec44992e48dd1fed Parents: 936dc95 Author: Pavel Tupitsyn Authored: Wed Dec 6 20:14:55 2017 +0300 Committer: Pavel Tupitsyn Committed: Wed Dec 6 20:14:55 2017 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Benchmarks.csproj | 2 + .../Interop/PlatformBenchmarkBase.cs | 21 +++++++ .../ThinClient/ThinClientGetBenchmark.cs | 63 ++++++++++++++++++++ .../ThinClient/ThinClientPutBenchmark.cs | 59 ++++++++++++++++++ 4 files changed, 145 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/9813c626/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj index 65dfc1e..b5c2074 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj +++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Apache.Ignite.Benchmarks.csproj @@ -69,6 +69,8 @@ + + http://git-wip-us.apache.org/repos/asf/ignite/blob/9813c626/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PlatformBenchmarkBase.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PlatformBenchmarkBase.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PlatformBenchmarkBase.cs index f437eb8..ca9fb0c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PlatformBenchmarkBase.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Interop/PlatformBenchmarkBase.cs @@ -18,9 +18,11 @@ namespace Apache.Ignite.Benchmarks.Interop { using System.Collections.Generic; + using System.Net; using Apache.Ignite.Benchmarks.Model; using Apache.Ignite.Core; using Apache.Ignite.Core.Binary; + using Apache.Ignite.Core.Client; /// /// Base class for all platform benchmarks. @@ -117,5 +119,24 @@ namespace Apache.Ignite.Benchmarks.Interop /// Payload. /// public int Payload { get; set; } + + /// + /// Gets the client. + /// + protected IIgniteClient GetClient() + { + return Ignition.StartClient(GetClientConfiguration()); + } + + /// + /// Gets the client configuration. + /// + private IgniteClientConfiguration GetClientConfiguration() + { + return new IgniteClientConfiguration + { + Host = IPAddress.Loopback.ToString() + }; + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9813c626/modules/platforms/dotnet/Apache.Ignite.Benchmarks/ThinClient/ThinClientGetBenchmark.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/ThinClient/ThinClientGetBenchmark.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/ThinClient/ThinClientGetBenchmark.cs new file mode 100644 index 0000000..4af5f1f --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/ThinClient/ThinClientGetBenchmark.cs @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Benchmarks.ThinClient +{ + using System.Collections.Generic; + using Apache.Ignite.Benchmarks.Interop; + using Apache.Ignite.Benchmarks.Model; + using Apache.Ignite.Core.Client.Cache; + + /// + /// Cache get benchmark. + /// + internal class ThinClientGetBenchmark : PlatformBenchmarkBase + { + /** Cache name. */ + private const string CacheName = "cache"; + + /** Native cache wrapper. */ + private ICacheClient _cache; + + /** */ + protected override void OnStarted() + { + base.OnStarted(); + + _cache = GetClient().GetCache(CacheName); + + for (int i = 0; i < Emps.Length; i++) + _cache.Put(i, Emps[i]); + } + + /** */ + protected override void GetDescriptors(ICollection descs) + { + descs.Add(BenchmarkOperationDescriptor.Create("ThinClientGet", Get, 1)); + } + + /// + /// Cache get. + /// + private void Get(BenchmarkState state) + { + var idx = BenchmarkUtils.GetRandomInt(Dataset); + + _cache.Get(idx); + } + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/9813c626/modules/platforms/dotnet/Apache.Ignite.Benchmarks/ThinClient/ThinClientPutBenchmark.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/ThinClient/ThinClientPutBenchmark.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/ThinClient/ThinClientPutBenchmark.cs new file mode 100644 index 0000000..deb9c99 --- /dev/null +++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/ThinClient/ThinClientPutBenchmark.cs @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite.Benchmarks.ThinClient +{ + using System.Collections.Generic; + using Apache.Ignite.Benchmarks.Interop; + using Apache.Ignite.Core.Client.Cache; + + /// + /// Cache put benchmark. + /// + internal class ThinClientPutBenchmark : PlatformBenchmarkBase + { + /** Cache name. */ + private const string CacheName = "cache"; + + /** Native cache wrapper. */ + private ICacheClient _cache; + + /** */ + protected override void OnStarted() + { + base.OnStarted(); + + _cache = GetClient().GetCache(CacheName); + } + + /** */ + protected override void GetDescriptors(ICollection descs) + { + descs.Add(BenchmarkOperationDescriptor.Create("ThinClientPut", Put, 1)); + } + + /// + /// Cache put. + /// + private void Put(BenchmarkState state) + { + int idx = BenchmarkUtils.GetRandomInt(Dataset); + + _cache.Put(idx, Emps[idx]); + } + } +}