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>
import org.slf4j.Logger;
public class RaftActorContextImpl implements RaftActorContext {
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;
private final ActorRef actor;
leaf shard-snapshot-data-threshold-percentage {
default 12;
type percentage;
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";