You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/05/17 10:32:48 UTC
[09/17] ignite git commit: IGNITE-5050 .NET: IIgnite.GetMemoryMetrics
IGNITE-5050 .NET: IIgnite.GetMemoryMetrics
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/73fc01c4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/73fc01c4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/73fc01c4
Branch: refs/heads/ignite-5075
Commit: 73fc01c4f021854e3fdc5c9a3bfe9a0650a77055
Parents: 1fef59c
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue May 16 19:32:48 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue May 16 19:32:48 2017 +0300
----------------------------------------------------------------------
.../platform/cluster/PlatformClusterGroup.java | 20 +++
.../utils/PlatformConfigurationUtils.java | 4 +-
.../Apache.Ignite.Core.Tests.csproj | 1 +
.../Cache/MemoryMetricsTest.cs | 134 +++++++++++++++++++
.../IgniteConfigurationSerializerTest.cs | 6 +-
.../IgniteConfigurationTest.cs | 4 +-
.../Apache.Ignite.Core.csproj | 2 +
.../Configuration/MemoryPolicyConfiguration.cs | 9 ++
.../Apache.Ignite.Core/Cache/IMemoryMetrics.cs | 55 ++++++++
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 7 +
.../IgniteConfigurationSection.xsd | 5 +
.../Impl/Cache/MemoryMetrics.cs | 62 +++++++++
.../Impl/Cluster/ClusterGroupImpl.cs | 27 +++-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 6 +
14 files changed, 337 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
index 3e14e7a..5a5ebfd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
@@ -24,6 +24,7 @@ import java.util.UUID;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteCluster;
+import org.apache.ignite.MemoryMetrics;
import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.cluster.ClusterGroupEx;
@@ -108,6 +109,9 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
/** */
private static final int OP_RESET_LOST_PARTITIONS = 25;
+ /** */
+ private static final int OP_MEMORY_METRICS = 26;
+
/** Projection. */
private final ClusterGroupEx prj;
@@ -132,6 +136,22 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
break;
+ case OP_MEMORY_METRICS:
+ Collection<MemoryMetrics> metrics = prj.ignite().memoryMetrics();
+
+ writer.writeInt(metrics.size());
+
+ for (MemoryMetrics m : metrics) {
+ writer.writeString(m.getName());
+ writer.writeLong(m.getTotalAllocatedPages());
+ writer.writeFloat(m.getAllocationRate());
+ writer.writeFloat(m.getEvictionRate());
+ writer.writeFloat(m.getLargeEntriesPagesPercentage());
+ writer.writeFloat(m.getPagesFillFactor());
+ }
+
+ break;
+
default:
super.processOutStream(type, writer);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
index 98b438d..6ba88d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java
@@ -1350,7 +1350,8 @@ public class PlatformConfigurationUtils {
.setSwapFilePath(in.readString())
.setPageEvictionMode(DataPageEvictionMode.values()[in.readInt()])
.setEvictionThreshold(in.readDouble())
- .setEmptyPagesPoolSize(in.readInt());
+ .setEmptyPagesPoolSize(in.readInt())
+ .setMetricsEnabled(in.readBoolean());
plcs[i] = cfg;
}
@@ -1394,6 +1395,7 @@ public class PlatformConfigurationUtils {
w.writeInt(plc.getPageEvictionMode().ordinal());
w.writeDouble(plc.getEvictionThreshold());
w.writeInt(plc.getEmptyPagesPoolSize());
+ w.writeBoolean(plc.isMetricsEnabled());
}
}
else {
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 1c84a4d..13e4889 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -94,6 +94,7 @@
<Compile Include="Cache\CacheMetricsTest.cs" />
<Compile Include="Cache\CacheResultTest.cs" />
<Compile Include="Cache\CacheTestKey.cs" />
+ <Compile Include="Cache\MemoryMetricsTest.cs" />
<Compile Include="Cache\NonSerializableCacheEntryProcessor.cs" />
<Compile Include="Cache\NonSerializableException.cs" />
<Compile Include="Cache\PartitionLossTest.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs
new file mode 100644
index 0000000..07b596a
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/MemoryMetricsTest.cs
@@ -0,0 +1,134 @@
+/*
+ * 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.Core.Tests.Cache
+{
+ using System.Linq;
+ using Apache.Ignite.Core.Cache;
+ using Apache.Ignite.Core.Cache.Configuration;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Memory metrics tests.
+ /// </summary>
+ public class MemoryMetricsTest
+ {
+ /** */
+ private const string MemoryPolicyWithMetrics = "plcWithMetrics";
+
+ /** */
+ private const string MemoryPolicyNoMetrics = "plcNoMetrics";
+
+ /// <summary>
+ /// Tests the memory metrics.
+ /// </summary>
+ [Test]
+ public void TestMemoryMetrics()
+ {
+ var ignite = StartIgniteWithTwoPolicies();
+
+ // Verify metrics.
+ var metrics = ignite.GetMemoryMetrics().ToArray();
+ Assert.AreEqual(3, metrics.Length); // two defined plus system.
+
+ var sysMetrics = metrics[0];
+ Assert.AreEqual("sysMemPlc", sysMetrics.Name);
+ AssertMetricsAreEmpty(sysMetrics);
+
+ var memMetrics = metrics[1];
+ Assert.AreEqual(MemoryPolicyWithMetrics, memMetrics.Name);
+ Assert.Greater(memMetrics.AllocationRate, 0);
+ Assert.AreEqual(0, memMetrics.EvictionRate);
+ Assert.AreEqual(0, memMetrics.LargeEntriesPagesPercentage);
+ Assert.Greater(memMetrics.PageFillFactor, 0);
+ Assert.Greater(memMetrics.TotalAllocatedPages, 1000);
+
+ var emptyMetrics = metrics[2];
+ Assert.AreEqual(MemoryPolicyNoMetrics, emptyMetrics.Name);
+ AssertMetricsAreEmpty(emptyMetrics);
+ }
+
+ /// <summary>
+ /// Asserts that metrics are empty.
+ /// </summary>
+ private static void AssertMetricsAreEmpty(IMemoryMetrics metrics)
+ {
+ Assert.AreEqual(0, metrics.AllocationRate);
+ Assert.AreEqual(0, metrics.EvictionRate);
+ Assert.AreEqual(0, metrics.LargeEntriesPagesPercentage);
+ Assert.AreEqual(0, metrics.PageFillFactor);
+ Assert.AreEqual(0, metrics.TotalAllocatedPages);
+ }
+
+ /// <summary>
+ /// Starts the ignite with two policies.
+ /// </summary>
+ private static IIgnite StartIgniteWithTwoPolicies()
+ {
+ var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration())
+ {
+ MemoryConfiguration = new MemoryConfiguration
+ {
+ DefaultMemoryPolicyName = MemoryPolicyWithMetrics,
+ MemoryPolicies = new[]
+ {
+ new MemoryPolicyConfiguration
+ {
+ Name = MemoryPolicyWithMetrics,
+ MetricsEnabled = true
+ },
+ new MemoryPolicyConfiguration
+ {
+ Name = MemoryPolicyNoMetrics,
+ MetricsEnabled = false
+ }
+ }
+ }
+ };
+
+ var ignite = Ignition.Start(cfg);
+
+ // Create caches and do some things with them.
+ var cacheNoMetrics = ignite.CreateCache<int, int>(new CacheConfiguration("cacheNoMetrics")
+ {
+ MemoryPolicyName = MemoryPolicyNoMetrics
+ });
+
+ cacheNoMetrics.Put(1, 1);
+ cacheNoMetrics.Get(1);
+
+ var cacheWithMetrics = ignite.CreateCache<int, int>(new CacheConfiguration("cacheWithMetrics")
+ {
+ MemoryPolicyName = MemoryPolicyWithMetrics
+ });
+
+ cacheWithMetrics.Put(1, 1);
+ cacheWithMetrics.Get(1);
+
+ return ignite;
+ }
+
+ /// <summary>
+ /// Tears down the test.
+ /// </summary>
+ [TearDown]
+ public void TearDown()
+ {
+ Ignition.StopAll(true);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
index bc0321e..5bbf722 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs
@@ -136,7 +136,7 @@ namespace Apache.Ignite.Core.Tests
<eventStorageSpi type='MemoryEventStorageSpi' expirationTimeout='00:00:23.45' maxEventCount='129' />
<memoryConfiguration concurrencyLevel='3' defaultMemoryPolicyName='dfPlc' pageSize='45' systemCacheInitialSize='67' systemCacheMaxSize='68'>
<memoryPolicies>
- <memoryPolicyConfiguration emptyPagesPoolSize='1' evictionThreshold='0.2' name='dfPlc' pageEvictionMode='RandomLru' initialSize='89' maxSize='98' swapFilePath='abc' />
+ <memoryPolicyConfiguration emptyPagesPoolSize='1' evictionThreshold='0.2' name='dfPlc' pageEvictionMode='RandomLru' initialSize='89' maxSize='98' swapFilePath='abc' metricsEnabled='true' />
</memoryPolicies>
</memoryConfiguration>
</igniteConfig>";
@@ -272,6 +272,7 @@ namespace Apache.Ignite.Core.Tests
Assert.AreEqual("abc", memPlc.SwapFilePath);
Assert.AreEqual(89, memPlc.InitialSize);
Assert.AreEqual(98, memPlc.MaxSize);
+ Assert.IsTrue(memPlc.MetricsEnabled);
}
/// <summary>
@@ -826,7 +827,8 @@ namespace Apache.Ignite.Core.Tests
PageEvictionMode = DataPageEvictionMode.RandomLru,
EvictionThreshold = 0.77,
EmptyPagesPoolSize = 66,
- SwapFilePath = "somePath2"
+ SwapFilePath = "somePath2",
+ MetricsEnabled = true
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
index ebca7c4..ae82d8a 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs
@@ -594,6 +594,7 @@ namespace Apache.Ignite.Core.Tests
{
Name = "myDefaultPlc",
PageEvictionMode = DataPageEvictionMode.Random2Lru,
+ InitialSize = 340 * 1024 * 1024,
MaxSize = 345 * 1024 * 1024,
EvictionThreshold = 0.88,
EmptyPagesPoolSize = 77,
@@ -606,7 +607,8 @@ namespace Apache.Ignite.Core.Tests
MaxSize = 456 * 1024 * 1024,
EvictionThreshold = 0.77,
EmptyPagesPoolSize = 66,
- SwapFilePath = "somePath2"
+ SwapFilePath = "somePath2",
+ MetricsEnabled = true
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 7cf79dd..fd6e5ec 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -95,6 +95,7 @@
<Compile Include="Cache\Configuration\DataPageEvictionMode.cs" />
<Compile Include="Cache\Configuration\MemoryPolicyConfiguration.cs" />
<Compile Include="Cache\Configuration\PartitionLossPolicy.cs" />
+ <Compile Include="Cache\IMemoryMetrics.cs" />
<Compile Include="Common\ExceptionFactory.cs" />
<Compile Include="Events\IEventStorageSpi.cs" />
<Compile Include="Events\MemoryEventStorageSpi.cs" />
@@ -196,6 +197,7 @@
<Compile Include="Impl\Binary\ReflectionUtils.cs" />
<Compile Include="Cache\Affinity\AffinityFunctionBase.cs" />
<Compile Include="Impl\Binary\TypeNameParser.cs" />
+ <Compile Include="Impl\Cache\MemoryMetrics.cs" />
<Compile Include="Impl\Cache\Store\CacheStore.cs" />
<Compile Include="Impl\Cache\Store\ICacheStoreInternal.cs" />
<Compile Include="Impl\Transactions\CacheTransactionManager.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
index e6e9153..1db9ea9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs
@@ -71,6 +71,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
PageEvictionMode = (DataPageEvictionMode) reader.ReadInt();
EvictionThreshold = reader.ReadDouble();
EmptyPagesPoolSize = reader.ReadInt();
+ MetricsEnabled = reader.ReadBoolean();
}
/// <summary>
@@ -85,6 +86,7 @@ namespace Apache.Ignite.Core.Cache.Configuration
writer.WriteInt((int) PageEvictionMode);
writer.WriteDouble(EvictionThreshold);
writer.WriteInt(EmptyPagesPoolSize);
+ writer.WriteBoolean(MetricsEnabled);
}
/// <summary>
@@ -140,5 +142,12 @@ namespace Apache.Ignite.Core.Cache.Configuration
/// </summary>
[DefaultValue(DefaultEmptyPagesPoolSize)]
public int EmptyPagesPoolSize { get;set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether memory metrics should be enabled.
+ /// <para />
+ /// Metrics can be retrieved with <see cref="IIgnite.GetMemoryMetrics"/> method.
+ /// </summary>
+ public bool MetricsEnabled { get; set; }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core/Cache/IMemoryMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/IMemoryMetrics.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/IMemoryMetrics.cs
new file mode 100644
index 0000000..0298c1f
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/IMemoryMetrics.cs
@@ -0,0 +1,55 @@
+/*
+ * 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.Core.Cache
+{
+ /// <summary>
+ /// Memory usage metrics.
+ /// </summary>
+ public interface IMemoryMetrics
+ {
+ /// <summary>
+ /// Gets the memory policy name.
+ /// </summary>
+ string Name { get; }
+
+ /// <summary>
+ /// Gets the count of allocated pages.
+ /// </summary>
+ long TotalAllocatedPages { get; }
+
+ /// <summary>
+ /// Gets the allocation rate, in pages per second.
+ /// </summary>
+ float AllocationRate { get; }
+
+ /// <summary>
+ /// Gets the eviction rate, in pages per second.
+ /// </summary>
+ float EvictionRate { get; }
+
+ /// <summary>
+ /// Gets the percentage of pages fully occupied by entries that are larger than page.
+ /// </summary>
+ float LargeEntriesPagesPercentage { get; }
+
+ /// <summary>
+ /// Gets the page fill factor: free space to overall size ratio across all pages.
+ /// </summary>
+ float PageFillFactor { get; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
index 05a8ae3..863952b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IIgnite.cs
@@ -330,5 +330,12 @@ namespace Apache.Ignite.Core
/// </summary>
/// <param name="cacheNames">Names of caches to reset partitions for.</param>
void ResetLostPartitions(params string[] cacheNames);
+
+ /// <summary>
+ /// Gets a collection of memory metrics, one for each <see cref="MemoryConfiguration.MemoryPolicies"/>.
+ /// <para />
+ /// Memory metrics should be enabled with <see cref="MemoryPolicyConfiguration.MetricsEnabled"/>.
+ /// </summary>
+ ICollection<IMemoryMetrics> GetMemoryMetrics();
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
index 253a33e..ad92661 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd
@@ -1193,6 +1193,11 @@
<xs:documentation>Path to the memory-mapped file the memory region defined by this memory policy will be mapped to.</xs:documentation>
</xs:annotation>
</xs:attribute>
+ <xs:attribute name="metricsEnabled" type="xs:boolean">
+ <xs:annotation>
+ <xs:documentation>Enable memory metrics.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MemoryMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MemoryMetrics.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MemoryMetrics.cs
new file mode 100644
index 0000000..ae9f85c
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/MemoryMetrics.cs
@@ -0,0 +1,62 @@
+/*
+ * 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.Core.Impl.Cache
+{
+ using System.Diagnostics;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Cache;
+
+ /// <summary>
+ /// Memory metrics.
+ /// </summary>
+ internal class MemoryMetrics : IMemoryMetrics
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MemoryMetrics"/> class.
+ /// </summary>
+ public MemoryMetrics(IBinaryRawReader reader)
+ {
+ Debug.Assert(reader != null);
+
+ Name = reader.ReadString();
+ TotalAllocatedPages = reader.ReadLong();
+ AllocationRate = reader.ReadFloat();
+ EvictionRate = reader.ReadFloat();
+ LargeEntriesPagesPercentage = reader.ReadFloat();
+ PageFillFactor = reader.ReadFloat();
+ }
+
+ /** <inheritdoc /> */
+ public string Name { get; private set; }
+
+ /** <inheritdoc /> */
+ public long TotalAllocatedPages { get; private set; }
+
+ /** <inheritdoc /> */
+ public float AllocationRate { get; private set; }
+
+ /** <inheritdoc /> */
+ public float EvictionRate { get; private set; }
+
+ /** <inheritdoc /> */
+ public float LargeEntriesPagesPercentage { get; private set; }
+
+ /** <inheritdoc /> */
+ public float PageFillFactor { get; private set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
index 7e97852..ad180ee 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
@@ -117,7 +117,10 @@ namespace Apache.Ignite.Core.Impl.Cluster
/** */
private const int OpResetLostPartitions = 25;
-
+
+ /** */
+ private const int OpMemoryMetrics = 26;
+
/** Initial Ignite instance. */
private readonly Ignite _ignite;
@@ -553,6 +556,28 @@ namespace Apache.Ignite.Core.Impl.Cluster
}
/// <summary>
+ /// Gets the memory metrics.
+ /// </summary>
+ public ICollection<IMemoryMetrics> GetMemoryMetrics()
+ {
+ return DoInOp(OpMemoryMetrics, stream =>
+ {
+ IBinaryRawReader reader = Marshaller.StartUnmarshal(stream, false);
+
+ var cnt = reader.ReadInt();
+
+ var res = new List<IMemoryMetrics>(cnt);
+
+ for (int i = 0; i < cnt; i++)
+ {
+ res.Add(new MemoryMetrics(reader));
+ }
+
+ return res;
+ });
+ }
+
+ /// <summary>
/// Creates new Cluster Group from given native projection.
/// </summary>
/// <param name="prj">Native projection.</param>
http://git-wip-us.apache.org/repos/asf/ignite/blob/73fc01c4/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index 8fa1f6a..b392f9c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -731,6 +731,12 @@ namespace Apache.Ignite.Core.Impl
ResetLostPartitions((IEnumerable<string>) cacheNames);
}
+ /** <inheritdoc /> */
+ public ICollection<IMemoryMetrics> GetMemoryMetrics()
+ {
+ return _prj.GetMemoryMetrics();
+ }
+
/// <summary>
/// Gets or creates near cache.
/// </summary>