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 D6B8D200C64 for ; Fri, 28 Apr 2017 14:40:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D567F160B8C; Fri, 28 Apr 2017 12:40:13 +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 B7B38160BB8 for ; Fri, 28 Apr 2017 14:40:11 +0200 (CEST) Received: (qmail 83836 invoked by uid 500); 28 Apr 2017 12:40:11 -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 83822 invoked by uid 99); 28 Apr 2017 12:40:10 -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, 28 Apr 2017 12:40:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BFA2DDFF9F; Fri, 28 Apr 2017 12:40:10 +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, 28 Apr 2017 12:40:12 -0000 Message-Id: <8941e1aedebb4e6db36611615bf3f25d@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/9] ignite git commit: IGNITE-5072 - Updated memory metrics to comply with other metrics archived-at: Fri, 28 Apr 2017 12:40:14 -0000 http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java index 32c6675..0254c4c 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java @@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLongArray; import java.util.concurrent.locks.Lock; import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.configuration.MemoryPolicyConfiguration; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider; import org.apache.ignite.internal.pagemem.FullPageId; @@ -629,7 +630,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest { Map map = new HashMap<>(); - int loops = reuseList == null ? 100_000 : 300_000; + int loops = reuseList == null ? 20_000 : 60_000; for (int i = 0 ; i < loops; i++) { final Long x = (long)BPlusTree.randomInt(CNT); @@ -1232,7 +1233,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest { final Map map = new ConcurrentHashMap8<>(); - final int loops = reuseList == null ? 100_000 : 200_000; + final int loops = reuseList == null ? 20_000 : 60_000; final GridStripedLock lock = new GridStripedLock(256); @@ -1272,7 +1273,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest { tree.invoke(x, null, new IgniteTree.InvokeClosure() { IgniteTree.OperationType opType; - @Override public void call(@Nullable Long row) throws IgniteCheckedException { + @Override public void call(@Nullable Long row) { opType = PUT; if (row != null) @@ -1294,7 +1295,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest { tree.invoke(x, null, new IgniteTree.InvokeClosure() { IgniteTree.OperationType opType; - @Override public void call(@Nullable Long row) throws IgniteCheckedException { + @Override public void call(@Nullable Long row) { if (row != null) { assertEquals(x, row); opType = REMOVE; @@ -1685,8 +1686,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override public Long getLookupRow(BPlusTree tree, long pageAddr, int idx) - throws IgniteCheckedException { + @Override public Long getLookupRow(BPlusTree tree, long pageAddr, int idx) { Long row = PageUtils.getLong(pageAddr, offset(idx)); checkNotRemoved(row); @@ -1699,17 +1699,14 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest { * @return Page memory. */ protected PageMemory createPageMemory() throws Exception { - long[] sizes = new long[CPUS]; - - for (int i = 0; i < sizes.length; i++) - sizes[i] = 1024 * MB / CPUS; + MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(1024 * MB); PageMemory pageMem = new PageMemoryNoStoreImpl(log, - new UnsafeMemoryProvider(sizes), + new UnsafeMemoryProvider(log), null, PAGE_SIZE, - null, - new MemoryMetricsImpl(null), true); + plcCfg, + new MemoryMetricsImpl(plcCfg), true); pageMem.start(); @@ -1754,8 +1751,7 @@ public class BPlusTreeSelfTest extends GridCommonAbstractTest { } /** {@inheritDoc} */ - @Override public Long getLookupRow(BPlusTree tree, long pageAddr, int idx) - throws IgniteCheckedException { + @Override public Long getLookupRow(BPlusTree tree, long pageAddr, int idx) { return PageUtils.getLong(pageAddr, offset(idx)); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java index 1cede9b..5f61bd6 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/FreeListImplSelfTest.java @@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.configuration.MemoryPolicyConfiguration; import org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider; import org.apache.ignite.internal.pagemem.PageIdAllocator; import org.apache.ignite.internal.pagemem.PageMemory; @@ -145,7 +146,7 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest { /** * @param pageSize Page size. - * @throws Exception + * @throws Exception If failed. */ protected void checkInsertDeleteMultiThreaded(final int pageSize) throws Exception { final FreeList list = createFreeList(pageSize); @@ -175,7 +176,7 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest { @Override public Object call() throws Exception { Random rnd = ThreadLocalRandom.current(); - for (int i = 0; i < 1_000_000; i++) { + for (int i = 0; i < 200_000; i++) { boolean grow0 = grow.get(); if (grow0) { @@ -313,18 +314,13 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest { /** * @return Page memory. */ - protected PageMemory createPageMemory(int pageSize) throws Exception { - long[] sizes = new long[CPUS]; - - for (int i = 0; i < sizes.length; i++) - sizes[i] = 1024 * MB / CPUS; - + protected PageMemory createPageMemory(int pageSize, MemoryPolicyConfiguration plcCfg) throws Exception { PageMemory pageMem = new PageMemoryNoStoreImpl(log, - new UnsafeMemoryProvider(sizes), + new UnsafeMemoryProvider(log), null, pageSize, - null, - new MemoryMetricsImpl(null), + plcCfg, + new MemoryMetricsImpl(plcCfg), true); pageMem.start(); @@ -338,13 +334,15 @@ public class FreeListImplSelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ protected FreeList createFreeList(int pageSize) throws Exception { - pageMem = createPageMemory(pageSize); + MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(1024 * MB); + + pageMem = createPageMemory(pageSize, plcCfg); long metaPageId = pageMem.allocatePage(1, 1, PageIdAllocator.FLAG_DATA); - MemoryMetricsImpl metrics = new MemoryMetricsImpl(null); + MemoryMetricsImpl metrics = new MemoryMetricsImpl(plcCfg); - MemoryPolicy memPlc = new MemoryPolicy(pageMem, null, metrics, new NoOpPageEvictionTracker()); + MemoryPolicy memPlc = new MemoryPolicy(pageMem, plcCfg, metrics, new NoOpPageEvictionTracker()); return new FreeListImpl(1, "freelist", metrics, memPlc, null, null, metaPageId, true); } http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java index a2732e8..3b3e1de 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/IgniteDbDynamicCacheSelfTest.java @@ -44,7 +44,7 @@ public class IgniteDbDynamicCacheSelfTest extends GridCommonAbstractTest { MemoryPolicyConfiguration plc = new MemoryPolicyConfiguration(); plc.setName("dfltPlc"); - plc.setSize(200 * 1024 * 1024); + plc.setMaxSize(200 * 1024 * 1024); dbCfg.setDefaultMemoryPolicyName("dfltPlc"); dbCfg.setMemoryPolicies(plc); http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java index 5347a23..cb5700f 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MemoryMetricsSelfTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.database; import java.util.concurrent.CountDownLatch; import org.apache.ignite.MemoryMetrics; +import org.apache.ignite.configuration.MemoryPolicyConfiguration; import org.apache.ignite.internal.processors.cache.database.MemoryMetricsImpl; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; @@ -41,7 +42,9 @@ public class MemoryMetricsSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { - memMetrics = new MemoryMetricsImpl(null); + MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration(); + + memMetrics = new MemoryMetricsImpl(plcCfg); memMetrics.enableMetrics(); } http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java index 61c8ad9..af0b849 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/MetadataStorageSelfTest.java @@ -17,6 +17,7 @@ package org.apache.ignite.internal.processors.database; +import org.apache.ignite.configuration.MemoryPolicyConfiguration; import org.apache.ignite.internal.mem.DirectMemoryProvider; import org.apache.ignite.internal.pagemem.FullPageId; import org.apache.ignite.internal.pagemem.PageIdAllocator; @@ -154,13 +155,17 @@ public class MetadataStorageSelfTest extends GridCommonAbstractTest { * @return Page memory instance. */ protected PageMemory memory(boolean clean) throws Exception { - long[] sizes = new long[10]; - - for (int i = 0; i < sizes.length; i++) - sizes[i] = 1024 * 1024; - - DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), allocationPath, clean, sizes); - - return new PageMemoryNoStoreImpl(log, provider, null, PAGE_SIZE, null, new MemoryMetricsImpl(null), true); + DirectMemoryProvider provider = new MappedFileMemoryProvider(log(), allocationPath); + + MemoryPolicyConfiguration plcCfg = new MemoryPolicyConfiguration().setMaxSize(30 * 1024 * 1024); + + return new PageMemoryNoStoreImpl( + log, + provider, + null, + PAGE_SIZE, + plcCfg, + new MemoryMetricsImpl(plcCfg), + true); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java index fbe0872..456971a 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsSizeSelfTest.java @@ -397,7 +397,7 @@ public class IgfsSizeSelfTest extends IgfsCommonAbstractTest { String memPlcName = "igfsDataMemPlc"; cfg.setMemoryConfiguration(new MemoryConfiguration().setMemoryPolicies( - new MemoryPolicyConfiguration().setSize(maxSize).setName(memPlcName))); + new MemoryPolicyConfiguration().setMaxSize(maxSize).setName(memPlcName))); FileSystemConfiguration igfsCfg = cfg.getFileSystemConfiguration()[0]; http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/core/src/test/java/org/apache/ignite/platform/PlatformCacheWriteMetricsTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/platform/PlatformCacheWriteMetricsTask.java b/modules/core/src/test/java/org/apache/ignite/platform/PlatformCacheWriteMetricsTask.java index da013bd..b99424d 100644 --- a/modules/core/src/test/java/org/apache/ignite/platform/PlatformCacheWriteMetricsTask.java +++ b/modules/core/src/test/java/org/apache/ignite/platform/PlatformCacheWriteMetricsTask.java @@ -235,11 +235,6 @@ public class PlatformCacheWriteMetricsTask extends ComputeTaskAdapter - + + + - + + http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/cpp/core-test/config/cache-query-32.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/config/cache-query-32.xml b/modules/platforms/cpp/core-test/config/cache-query-32.xml index 6927705..ddbd690 100644 --- a/modules/platforms/cpp/core-test/config/cache-query-32.xml +++ b/modules/platforms/cpp/core-test/config/cache-query-32.xml @@ -33,14 +33,16 @@ - + + - + + http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/cpp/core-test/config/cache-query-continuous-32.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/config/cache-query-continuous-32.xml b/modules/platforms/cpp/core-test/config/cache-query-continuous-32.xml index b5f9854..84a5c60 100644 --- a/modules/platforms/cpp/core-test/config/cache-query-continuous-32.xml +++ b/modules/platforms/cpp/core-test/config/cache-query-continuous-32.xml @@ -29,14 +29,16 @@ - + + - + + http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/cpp/core-test/config/cache-store-32.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/config/cache-store-32.xml b/modules/platforms/cpp/core-test/config/cache-store-32.xml index f2b6682..ed46d4e 100644 --- a/modules/platforms/cpp/core-test/config/cache-store-32.xml +++ b/modules/platforms/cpp/core-test/config/cache-store-32.xml @@ -33,14 +33,16 @@ - + + - + + http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/cpp/core-test/config/cache-test-32.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/core-test/config/cache-test-32.xml b/modules/platforms/cpp/core-test/config/cache-test-32.xml index 3535ae4..889f246 100644 --- a/modules/platforms/cpp/core-test/config/cache-test-32.xml +++ b/modules/platforms/cpp/core-test/config/cache-test-32.xml @@ -33,14 +33,16 @@ - + + - + + http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/cpp/odbc-test/config/queries-test-32.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/queries-test-32.xml b/modules/platforms/cpp/odbc-test/config/queries-test-32.xml index dd7cfb6..f7d9ff4 100644 --- a/modules/platforms/cpp/odbc-test/config/queries-test-32.xml +++ b/modules/platforms/cpp/odbc-test/config/queries-test-32.xml @@ -30,14 +30,16 @@ - + + - + + http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/cpp/odbc-test/config/queries-test-noodbc-32.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/cpp/odbc-test/config/queries-test-noodbc-32.xml b/modules/platforms/cpp/odbc-test/config/queries-test-noodbc-32.xml index 8060107..01cae20 100644 --- a/modules/platforms/cpp/odbc-test/config/queries-test-noodbc-32.xml +++ b/modules/platforms/cpp/odbc-test/config/queries-test-noodbc-32.xml @@ -30,14 +30,16 @@ - + + - + + http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs index 9af103b..cf70970 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheConfigurationTest.cs @@ -75,7 +75,8 @@ namespace Apache.Ignite.Core.Tests.Cache new MemoryPolicyConfiguration { Name = "myMemPolicy", - Size = 99 * 1024 * 1024 + InitialSize = 77 * 1024 * 1024, + MaxSize = 99 * 1024 * 1024 } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs index b409a5a..4b587a9 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheMetricsTest.cs @@ -165,7 +165,6 @@ namespace Apache.Ignite.Core.Tests.Cache Assert.AreEqual(25, metrics.OffHeapPrimaryEntriesCount); Assert.AreEqual(26, metrics.OffHeapBackupEntriesCount); Assert.AreEqual(27, metrics.OffHeapAllocatedSize); - Assert.AreEqual(28, metrics.OffHeapMaxSize); Assert.AreEqual(29, metrics.Size); Assert.AreEqual(30, metrics.KeySize); Assert.AreEqual(true, metrics.IsEmpty); http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml index 2bf7478..dd0669a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Config/spring-test.xml @@ -42,5 +42,19 @@ + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/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 dfd0d09..bc0321e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationSerializerTest.cs @@ -134,9 +134,9 @@ namespace Apache.Ignite.Core.Tests - + - + "; @@ -261,7 +261,8 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual(3, memCfg.ConcurrencyLevel); Assert.AreEqual("dfPlc", memCfg.DefaultMemoryPolicyName); Assert.AreEqual(45, memCfg.PageSize); - Assert.AreEqual(67, memCfg.SystemCacheMemorySize); + Assert.AreEqual(67, memCfg.SystemCacheInitialSize); + Assert.AreEqual(68, memCfg.SystemCacheMaxSize); var memPlc = memCfg.MemoryPolicies.Single(); Assert.AreEqual(1, memPlc.EmptyPagesPoolSize); @@ -269,7 +270,8 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual("dfPlc", memPlc.Name); Assert.AreEqual(DataPageEvictionMode.RandomLru, memPlc.PageEvictionMode); Assert.AreEqual("abc", memPlc.SwapFilePath); - Assert.AreEqual(89, memPlc.Size); + Assert.AreEqual(89, memPlc.InitialSize); + Assert.AreEqual(98, memPlc.MaxSize); } /// @@ -804,14 +806,16 @@ namespace Apache.Ignite.Core.Tests ConcurrencyLevel = 3, DefaultMemoryPolicyName = "somePolicy", PageSize = 4, - SystemCacheMemorySize = 5, + SystemCacheInitialSize = 5, + SystemCacheMaxSize = 6, MemoryPolicies = new[] { new MemoryPolicyConfiguration { Name = "myDefaultPlc", PageEvictionMode = DataPageEvictionMode.Random2Lru, - Size = 345 * 1024 * 1024, + InitialSize = 245 * 1024 * 1024, + MaxSize = 345 * 1024 * 1024, EvictionThreshold = 0.88, EmptyPagesPoolSize = 77, SwapFilePath = "myPath1" @@ -820,7 +824,6 @@ namespace Apache.Ignite.Core.Tests { Name = "customPlc", PageEvictionMode = DataPageEvictionMode.RandomLru, - Size = 456 * 1024 * 1024, EvictionThreshold = 0.77, EmptyPagesPoolSize = 66, SwapFilePath = "somePath2" http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/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 5f4a8ca..ebca7c4 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteConfigurationTest.cs @@ -199,7 +199,8 @@ namespace Apache.Ignite.Core.Tests Assert.AreEqual(memCfg.PageSize, resMemCfg.PageSize); Assert.AreEqual(memCfg.ConcurrencyLevel, resMemCfg.ConcurrencyLevel); Assert.AreEqual(memCfg.DefaultMemoryPolicyName, resMemCfg.DefaultMemoryPolicyName); - Assert.AreEqual(memCfg.SystemCacheMemorySize, resMemCfg.SystemCacheMemorySize); + Assert.AreEqual(memCfg.SystemCacheInitialSize, resMemCfg.SystemCacheInitialSize); + Assert.AreEqual(memCfg.SystemCacheMaxSize, resMemCfg.SystemCacheMaxSize); Assert.IsNotNull(memCfg.MemoryPolicies); Assert.IsNotNull(resMemCfg.MemoryPolicies); Assert.AreEqual(2, memCfg.MemoryPolicies.Count); @@ -211,7 +212,7 @@ namespace Apache.Ignite.Core.Tests var resPlc = resMemCfg.MemoryPolicies.Skip(i).First(); Assert.AreEqual(plc.PageEvictionMode, resPlc.PageEvictionMode); - Assert.AreEqual(plc.Size, resPlc.Size); + Assert.AreEqual(plc.MaxSize, resPlc.MaxSize); Assert.AreEqual(plc.EmptyPagesPoolSize, resPlc.EmptyPagesPoolSize); Assert.AreEqual(plc.EvictionThreshold, resPlc.EvictionThreshold); Assert.AreEqual(plc.Name, resPlc.Name); @@ -245,6 +246,22 @@ namespace Apache.Ignite.Core.Tests var disco = resCfg.DiscoverySpi as TcpDiscoverySpi; Assert.IsNotNull(disco); Assert.AreEqual(TimeSpan.FromMilliseconds(300), disco.SocketTimeout); + + // Check memory configuration defaults. + var mem = resCfg.MemoryConfiguration; + + Assert.IsNotNull(mem); + Assert.AreEqual("dfltPlc", mem.DefaultMemoryPolicyName); + Assert.AreEqual(MemoryConfiguration.DefaultPageSize, mem.PageSize); + Assert.AreEqual(MemoryConfiguration.DefaultSystemCacheInitialSize, mem.SystemCacheInitialSize); + Assert.AreEqual(MemoryConfiguration.DefaultSystemCacheMaxSize, mem.SystemCacheMaxSize); + + var plc = mem.MemoryPolicies.Single(); + Assert.AreEqual("dfltPlc", plc.Name); + Assert.AreEqual(MemoryPolicyConfiguration.DefaultEmptyPagesPoolSize, plc.EmptyPagesPoolSize); + Assert.AreEqual(MemoryPolicyConfiguration.DefaultEvictionThreshold, plc.EvictionThreshold); + Assert.AreEqual(MemoryPolicyConfiguration.DefaultInitialSize, plc.InitialSize); + Assert.AreEqual(MemoryPolicyConfiguration.DefaultMaxSize, plc.MaxSize); } } @@ -446,7 +463,9 @@ namespace Apache.Ignite.Core.Tests { var props = obj.GetType().GetProperties(); - foreach (var prop in props.Where(p => p.Name != "SelectorsCount" && p.Name != "ReadStripesNumber")) + foreach (var prop in props.Where(p => p.Name != "SelectorsCount" && p.Name != "ReadStripesNumber" && + !(p.Name == "MaxSize" && + p.DeclaringType == typeof(MemoryPolicyConfiguration)))) { var attr = prop.GetCustomAttributes(true).OfType().FirstOrDefault(); var propValue = prop.GetValue(obj, null); @@ -567,14 +586,15 @@ namespace Apache.Ignite.Core.Tests ConcurrencyLevel = 3, DefaultMemoryPolicyName = "myDefaultPlc", PageSize = 2048, - SystemCacheMemorySize = 13 * 1024 * 1024, + SystemCacheInitialSize = 13 * 1024 * 1024, + SystemCacheMaxSize = 15 * 1024 * 1024, MemoryPolicies = new[] { new MemoryPolicyConfiguration { Name = "myDefaultPlc", PageEvictionMode = DataPageEvictionMode.Random2Lru, - Size = 345 * 1024 * 1024, + MaxSize = 345 * 1024 * 1024, EvictionThreshold = 0.88, EmptyPagesPoolSize = 77, SwapFilePath = "myPath1" @@ -583,7 +603,7 @@ namespace Apache.Ignite.Core.Tests { Name = "customPlc", PageEvictionMode = DataPageEvictionMode.RandomLru, - Size = 456 * 1024 * 1024, + MaxSize = 456 * 1024 * 1024, EvictionThreshold = 0.77, EmptyPagesPoolSize = 66, SwapFilePath = "somePath2" http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs index f3897e6..a6263d7 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/DataPageEvictionMode.cs @@ -34,10 +34,10 @@ namespace Apache.Ignite.Core.Cache.Configuration /// /// Once a memory region defined by a memory policy is configured, an off-heap array is allocated to track /// last usage timestamp for every individual data page. The size of the array equals to - /// / . + /// / . /// /// When a data page is accessed, its timestamp gets updated in the tracking array. The page index in the - /// tracking array equals to pageAddress / . + /// tracking array equals to pageAddress / . /// /// When some pages need to be evicted, the algorithm randomly chooses 5 indexes from the tracking array and /// evicts a page with the latest timestamp. If some of the indexes point to non-data pages http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs index 9c4bb35..36d06a7 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryConfiguration.cs @@ -46,9 +46,14 @@ namespace Apache.Ignite.Core.Cache.Configuration public class MemoryConfiguration { /// - /// The default system cache memory size. + /// Default size of a memory chunk reserved for system cache initially. /// - public const long DefaultSystemCacheMemorySize = 100 * 1024 * 1024; + public const long DefaultSystemCacheInitialSize = 40 * 1024 * 1024; + + /// + /// Default max size of a memory chunk for the system cache. + /// + public const long DefaultSystemCacheMaxSize = 100 * 1024 * 1024; /// /// The default page size. @@ -65,7 +70,8 @@ namespace Apache.Ignite.Core.Cache.Configuration /// public MemoryConfiguration() { - SystemCacheMemorySize = DefaultSystemCacheMemorySize; + SystemCacheInitialSize = DefaultSystemCacheInitialSize; + SystemCacheMaxSize = DefaultSystemCacheMaxSize; PageSize = DefaultPageSize; DefaultMemoryPolicyName = DefaultDefaultMemoryPolicyName; } @@ -78,7 +84,8 @@ namespace Apache.Ignite.Core.Cache.Configuration { Debug.Assert(reader != null); - SystemCacheMemorySize = reader.ReadLong(); + SystemCacheInitialSize = reader.ReadLong(); + SystemCacheMaxSize = reader.ReadLong(); PageSize = reader.ReadInt(); ConcurrencyLevel = reader.ReadInt(); DefaultMemoryPolicyName = reader.ReadString(); @@ -101,7 +108,8 @@ namespace Apache.Ignite.Core.Cache.Configuration { Debug.Assert(writer != null); - writer.WriteLong(SystemCacheMemorySize); + writer.WriteLong(SystemCacheInitialSize); + writer.WriteLong(SystemCacheMaxSize); writer.WriteInt(PageSize); writer.WriteInt(ConcurrencyLevel); writer.WriteString(DefaultMemoryPolicyName); @@ -129,8 +137,14 @@ namespace Apache.Ignite.Core.Cache.Configuration /// /// Gets or sets the size of a memory chunk reserved for system cache needs. /// - [DefaultValue(DefaultSystemCacheMemorySize)] - public long SystemCacheMemorySize { get; set; } + [DefaultValue(DefaultSystemCacheInitialSize)] + public long SystemCacheInitialSize { get; set; } + + /// + /// Gets or sets the maximum memory region size reserved for system cache. + /// + [DefaultValue(DefaultSystemCacheMaxSize)] + public long SystemCacheMaxSize { get; set; } /// /// Gets or sets the size of the memory page. http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/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 fe4e91f..e6e9153 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Configuration/MemoryPolicyConfiguration.cs @@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Cache.Configuration { using System.ComponentModel; using Apache.Ignite.Core.Binary; + using Apache.Ignite.Core.Impl; /// /// Defines page memory policy configuration. See . @@ -36,6 +37,16 @@ namespace Apache.Ignite.Core.Cache.Configuration public const int DefaultEmptyPagesPoolSize = 100; /// + /// The default initial size. + /// + public const long DefaultInitialSize = 256 * 1024 * 1024; + + /// + /// The default maximum size, equals to 80% of total RAM. + /// + public static readonly long DefaultMaxSize = (long) ((long) NativeMethods.GetTotalPhysicalMemory() * 0.8); + + /// /// Initializes a new instance of the class. /// public MemoryPolicyConfiguration() @@ -43,6 +54,8 @@ namespace Apache.Ignite.Core.Cache.Configuration EvictionThreshold = DefaultEvictionThreshold; EmptyPagesPoolSize = DefaultEmptyPagesPoolSize; Name = MemoryConfiguration.DefaultDefaultMemoryPolicyName; + InitialSize = DefaultInitialSize; + MaxSize = DefaultMaxSize; } /// @@ -52,7 +65,8 @@ namespace Apache.Ignite.Core.Cache.Configuration internal MemoryPolicyConfiguration(IBinaryRawReader reader) { Name = reader.ReadString(); - Size = reader.ReadLong(); + InitialSize = reader.ReadLong(); + MaxSize = reader.ReadLong(); SwapFilePath = reader.ReadString(); PageEvictionMode = (DataPageEvictionMode) reader.ReadInt(); EvictionThreshold = reader.ReadDouble(); @@ -65,7 +79,8 @@ namespace Apache.Ignite.Core.Cache.Configuration internal void Write(IBinaryRawWriter writer) { writer.WriteString(Name); - writer.WriteLong(Size); + writer.WriteLong(InitialSize); + writer.WriteLong(MaxSize); writer.WriteString(SwapFilePath); writer.WriteInt((int) PageEvictionMode); writer.WriteDouble(EvictionThreshold); @@ -80,10 +95,17 @@ namespace Apache.Ignite.Core.Cache.Configuration public string Name { get; set; } /// - /// Gets or sets the maximum memory region size defined by this memory policy. - /// If the whole data can not fit into the memory region an out of memory exception will be thrown. + /// Gets or sets initial memory region size defined by this memory policy. + /// When the used memory size exceeds this value, new chunks of memory will be allocated. + /// + [DefaultValue(DefaultInitialSize)] + public long InitialSize { get; set; } + + /// + /// Sets maximum memory region size defined by this memory policy. The total size should not be less + /// than 10 MB due to internal data structures overhead. /// - public long Size { get; set; } + public long MaxSize { get; set; } /// /// Gets or sets the the path to the memory-mapped file the memory region defined by this memory policy @@ -97,7 +119,7 @@ namespace Apache.Ignite.Core.Cache.Configuration /// /// Gets or sets the page eviction mode. If is used (default) /// then an out of memory exception will be thrown if the memory region usage, - /// defined by this memory policy, goes beyond . + /// defined by this memory policy, goes beyond . /// public DataPageEvictionMode PageEvictionMode { get; set; } http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICacheMetrics.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICacheMetrics.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICacheMetrics.cs index 596322b..8289aaf 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICacheMetrics.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/ICacheMetrics.cs @@ -249,14 +249,6 @@ namespace Apache.Ignite.Core.Cache long OffHeapAllocatedSize { get; } /// - /// Gets off-heap memory maximum size. - /// - /// - /// Off-heap memory maximum size. - /// - long OffHeapMaxSize { get; } - - /// /// Gets number of non-null values in the cache. /// /// http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/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 9098d89..295457a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd +++ b/modules/platforms/dotnet/Apache.Ignite.Core/IgniteConfigurationSection.xsd @@ -1183,7 +1183,12 @@ Page eviction mode. - + + + Initial memory region size defined by this memory policy. + + + Maximum memory region size defined by this memory policy. @@ -1214,9 +1219,14 @@ Size of the memory page. - + + + Initial size of a memory chunk reserved for system cache needs. + + + - Size of a memory chunk reserved for system cache needs. + Maximum size of a memory chunk reserved for system cache needs. http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs index 53ff810..9ce713f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs @@ -110,9 +110,6 @@ namespace Apache.Ignite.Core.Impl.Cache private readonly long _offHeapAllocatedSize; /** */ - private readonly long _offHeapMaxSize; - - /** */ private readonly int _size; /** */ @@ -248,7 +245,6 @@ namespace Apache.Ignite.Core.Impl.Cache _offHeapPrimaryEntriesCount = reader.ReadLong(); _offHeapBackupEntriesCount = reader.ReadLong(); _offHeapAllocatedSize = reader.ReadLong(); - _offHeapMaxSize = reader.ReadLong(); _size = reader.ReadInt(); _keySize = reader.ReadInt(); _isEmpty = reader.ReadBoolean(); @@ -370,9 +366,6 @@ namespace Apache.Ignite.Core.Impl.Cache public long OffHeapAllocatedSize { get { return _offHeapAllocatedSize; } } /** */ - public long OffHeapMaxSize { get { return _offHeapMaxSize; } } - - /** */ public int Size { get { return _size; } } /** */ http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/modules/platforms/dotnet/Apache.Ignite.Core/Impl/NativeMethods.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/NativeMethods.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/NativeMethods.cs index 3403dee..0004772 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/NativeMethods.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/NativeMethods.cs @@ -45,5 +45,49 @@ namespace Apache.Ignite.Core.Impl [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)] internal static extern IntPtr LoadLibrary(string path); + + /// + /// Gets the total physical memory. + /// + internal static ulong GetTotalPhysicalMemory() + { + var status = new MEMORYSTATUSEX(); + status.Init(); + + GlobalMemoryStatusEx(ref status); + + return status.ullTotalPhys; + } + + /// + /// Globals the memory status. + /// + [return: MarshalAs(UnmanagedType.Bool)] + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern bool GlobalMemoryStatusEx([In, Out] ref MEMORYSTATUSEX lpBuffer); + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + // ReSharper disable InconsistentNaming + // ReSharper disable MemberCanBePrivate.Local + private struct MEMORYSTATUSEX + { + public uint dwLength; + public readonly uint dwMemoryLoad; + public readonly ulong ullTotalPhys; + public readonly ulong ullAvailPhys; + public readonly ulong ullTotalPageFile; + public readonly ulong ullAvailPageFile; + public readonly ulong ullTotalVirtual; + public readonly ulong ullAvailVirtual; + public readonly ulong ullAvailExtendedVirtual; + + /// + /// Initializes a new instance of the struct. + /// + public void Init() + { + dwLength = (uint) Marshal.SizeOf(typeof(MEMORYSTATUSEX)); + } + } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/11c23b62/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 9c6a0d7..9a672cc 100644 --- a/pom.xml +++ b/pom.xml @@ -524,7 +524,7 @@ - + @@ -541,38 +541,38 @@ - - - - - - - - - + + + + + + + + + - + - + - - - - + + + +