Use configured maximum memory to determine limits 01/37501/3
authorRobert Varga <rovarga@cisco.com>
Tue, 12 Apr 2016 14:51:59 +0000 (16:51 +0200)
committerTom Pantelis <tpanteli@brocade.com>
Mon, 6 Jun 2016 04:07:40 +0000 (04:07 +0000)
Use of Runtime.totalMemory() leads to different behavior as memory grows,
meaning we will perform different snapshots based on initial memory sizing
as well as the memory pressures from other parts of the system (which mean
the total memory will grow differently).

Use Runtime.maxMemory() instead, which will cause snapshotting to work
consistently with a fully-used system.

Change-Id: If6e4a135dc0b9a9d4795d1e5d75f7cbc60550c0d
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorContextImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/yang/distributed-datastore-provider.yang

index e00ed896ec7700db78ecaced86337759679b5e91..9acf849f54d7e34f12ceac4f368bda12cb063585 100644 (file)
@@ -30,7 +30,7 @@ import org.opendaylight.controller.cluster.raft.policy.RaftPolicy;
 import org.slf4j.Logger;
 
 public class RaftActorContextImpl implements RaftActorContext {
-    private static final LongSupplier JVM_MEMORY_RETRIEVER = () -> Runtime.getRuntime().totalMemory();
+    private static final LongSupplier JVM_MEMORY_RETRIEVER = () -> Runtime.getRuntime().maxMemory();
 
     private final ActorRef actor;
 
index 8174c7786336417b9ae9a0c765721fb2fc655464..285de0ee0186f0003bd5aa64c64aa946507ca4c1 100644 (file)
@@ -101,7 +101,7 @@ module distributed-datastore-provider {
          leaf shard-snapshot-data-threshold-percentage {
             default 12;
             type percentage;
-            description "The percentage of Runtime.totalMemory() used by the in-memory journal log before a snapshot is to be taken";
+            description "The percentage of Runtime.maxMemory() used by the in-memory journal log before a snapshot is to be taken";
          }