Defer up to maxEntrySize flushes by default 00/111100/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 27 Mar 2024 04:09:55 +0000 (05:09 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 27 Mar 2024 04:18:04 +0000 (05:18 +0100)
Batching flushes has performance benefits in terms of throughput.
Keeping the flush size at maxEntrySize makes the flush times more
consistent, as the journal's syncs will be amortized to fit writing
maxEntrySize'd entries.

JIRA: CONTROLLER-2108
Change-Id: Ie385738f65d9503fdeeed6a9e0b5ced37fde7fd3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-akka-segmented-journal/src/main/java/org/opendaylight/controller/akka/segjournal/SegmentedFileJournal.java
opendaylight/md-sal/sal-akka-segmented-journal/src/test/resources/SegmentedFileJournalTest.conf
opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/factory-akka.conf
opendaylight/md-sal/sal-distributed-datastore/src/test/resources/segmented.conf

index 41a6add0ed7d6c29fbe3c2658836c7dc2c3aad01..b9320998c95f28b7fcbd8eb170bf1842d3b83a47 100644 (file)
@@ -45,7 +45,6 @@ public class SegmentedFileJournal extends AsyncWriteJournal {
     public static final String STORAGE_MAX_SEGMENT_SIZE = "max-segment-size";
     public static final int STORAGE_MAX_SEGMENT_SIZE_DEFAULT = STORAGE_MAX_ENTRY_SIZE_DEFAULT * 8;
     public static final String STORAGE_MAX_UNFLUSHED_BYTES = "max-unflushed-bytes";
-    public static final int STORAGE_MAX_UNFLUSHED_BYTES_DEFAULT = 0;
     public static final String STORAGE_MEMORY_MAPPED = "memory-mapped";
 
     private static final Logger LOG = LoggerFactory.getLogger(SegmentedFileJournal.class);
@@ -67,7 +66,7 @@ public class SegmentedFileJournal extends AsyncWriteJournal {
 
         maxEntrySize = getBytes(config, STORAGE_MAX_ENTRY_SIZE, STORAGE_MAX_ENTRY_SIZE_DEFAULT);
         maxSegmentSize = getBytes(config, STORAGE_MAX_SEGMENT_SIZE, STORAGE_MAX_SEGMENT_SIZE_DEFAULT);
-        maxUnflushedBytes = getBytes(config, STORAGE_MAX_UNFLUSHED_BYTES, STORAGE_MAX_UNFLUSHED_BYTES_DEFAULT);
+        maxUnflushedBytes = getBytes(config, STORAGE_MAX_UNFLUSHED_BYTES, maxEntrySize);
 
         if (config.hasPath(STORAGE_MEMORY_MAPPED)) {
             storage = config.getBoolean(STORAGE_MEMORY_MAPPED) ? StorageLevel.MAPPED : StorageLevel.DISK;
index e391a0dd5dcc5d2322f2176890cb2b1f9906bcb0..8fce93b097e1bd7effaacb95e351c87254dde1c8 100644 (file)
@@ -8,7 +8,6 @@ akka {
                 root-directory = "target/segmented-journal"
                 max-entry-size = 8M
                 max-segment-size = 32M
-                max-unflushed-bytes = 256K
                 memory-mapped = false
             }
         }
index 00be0551f6909ce0cfc1441038dd0a967d9b6845..9834e08ea89b8776d0521fd3db15ebd210d0e6ad 100644 (file)
@@ -163,8 +163,9 @@ odl-cluster-data {
           max-entry-size = 16M
           # Maximum size of a segment
           max-segment-size = 128M
-          # Maximum number of bytes that are written without synchronizing storage
-          max-unflushed-bytes = 1M
+          # Maximum number of bytes that are written without synchronizing storage. Defaults to max-entry-size.
+          # Set to <= 0 to flush immediately.
+          #max-unflushed-bytes = 1M
           # Map each segment into memory. Defaults to true, use false to keep a heap-based
           # buffer instead.
           memory-mapped = true
@@ -183,8 +184,9 @@ odl-cluster-data {
           max-entry-size = 512K
           # Maximum size of a segment
           max-segment-size = 1M
-          # Maximum number of bytes that are written without synchronizing storage
-          max-unflushed-bytes = 128K
+          # Maximum number of bytes that are written without synchronizing storage. Defaults to max-entry-size.
+          # Set to <= 0 to flush immediately.
+          #max-unflushed-bytes = 128K
           # Map each segment into memory. Note that while this can improve performance,
           # it will also place additional burden on system resources.
           memory-mapped = false
index a21cc3e178ab6842d871a9d5917d6461fd2eab44..7a0b83212f669b33b7092f0fead633064b065bb4 100644 (file)
@@ -28,7 +28,6 @@ Member1 {
           root-directory = "target/segmented-journal"
           max-entry-size = 8M
           max-segment-size = 32M
-          max-unflushed-bytes = 256K
           memory-mapped = false
         }
       }