ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [09/33] ignite git commit: IGNITE-6210 Fixed inefficient memory consumption by checkpoint buffer. This closes #2536
Date Wed, 20 Sep 2017 12:48:07 GMT
IGNITE-6210 Fixed inefficient memory consumption by checkpoint buffer. This closes #2536


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/858c1df1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/858c1df1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/858c1df1

Branch: refs/heads/ignite-3478
Commit: 858c1df1c5af2e9ba03de61e1e78c990e0283c7c
Parents: 0dd9755
Author: Dmitriy Govorukhin <dmitriy.govorukhin@gmail.com>
Authored: Mon Sep 18 17:02:14 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Mon Sep 18 17:02:14 2017 +0300

----------------------------------------------------------------------
 .../GridCacheDatabaseSharedManager.java            | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/858c1df1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 5e84048..5a772b5 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -628,7 +628,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     }
 
     /** */
-    private long[] calculateFragmentSizes(int concLvl, long cacheSize) {
+    private long[] calculateFragmentSizes(int concLvl, long cacheSize, long chpBufSize) {
         if (concLvl < 2)
             concLvl = Runtime.getRuntime().availableProcessors();
 
@@ -642,7 +642,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         for (int i = 0; i < concLvl; i++)
             sizes[i] = fragmentSize;
 
-        sizes[concLvl] = checkpointPageBufSize;
+        sizes[concLvl] = chpBufSize;
 
         return sizes;
     }
@@ -656,11 +656,22 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     ) {
         memMetrics.persistenceEnabled(true);
 
+        long cacheSize = plcCfg.getMaxSize();
+
+        // Checkpoint buffer size can not be greater than cache size, it does not make sense.
+        long chpBufSize = Math.min(checkpointPageBufSize, cacheSize);
+
+        if (checkpointPageBufSize > cacheSize)
+            U.quietAndInfo(log,
+                "Checkpoint page buffer size is too big, setting to an adjusted cache size
[size="
+                    + U.readableSize(cacheSize, false) + ",  memPlc=" + plcCfg.getName()
+ ']');
+
         PageMemoryImpl pageMem = new PageMemoryImpl(
             memProvider,
             calculateFragmentSizes(
                 memCfg.getConcurrencyLevel(),
-                plcCfg.getMaxSize()
+                cacheSize,
+                chpBufSize
             ),
             cctx,
             memCfg.getPageSize(),


Mime
View raw message