Skip to content

Commit ef73b09

Browse files
CASSANDRA-21134: Enable background-write Direct I/O in cassandra_latest.yaml
Add background_write_disk_access_mode: direct to cassandra_latest.yaml so new-install/latest configurations exercise Direct I/O by default, and keep the test latest config in sync (test/conf/latest_diff.yaml and the DTEST_JVM_DTESTS_USE_LATEST block in InstanceConfig.java). The cassandra.yaml default remains standard.
1 parent 313c56c commit ef73b09

4 files changed

Lines changed: 20 additions & 2 deletions

File tree

conf/cassandra_latest.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,21 @@ commitlog_disk_access_mode: auto
700700
# - direct: use direct I/O for compaction reads, bypassing the OS page cache
701701
# compaction_read_disk_access_mode: auto
702702

703+
# Set the disk access mode for writing compressed SSTables during background operations
704+
# (compaction, streaming, cleanup, repair, etc.). The allowed values are:
705+
# - standard: use buffered I/O (default)
706+
# - direct: use direct I/O, bypassing the OS page cache
707+
# Note: Only applies to compressed tables. Uncompressed tables always use buffered I/O.
708+
# Note: Memtable flushes always use buffered I/O regardless of this setting, as flushed
709+
# data benefits from page cache for subsequent reads.
710+
background_write_disk_access_mode: direct
711+
712+
# Size of the in-memory staging buffer for Direct IO background writes. Trades off syscall
713+
# frequency against per-flush blocking latency on the compaction thread.
714+
# Aligned up to filesystem block size; auto-expands to fit a single compressed chunk + CRC
715+
# + one block when chunk_length exceeds this value.
716+
# direct_write_buffer_size: 1MiB
717+
703718
# Compression to apply to SSTables as they flush for compressed tables.
704719
# Note that tables without compression enabled do not respect this flag.
705720
#

src/java/org/apache/cassandra/config/Config.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,8 +1287,7 @@ public enum DiskAccessMode
12871287
legacy,
12881288

12891289
/**
1290-
* Direct-I/O is enabled for commitlog disk only.
1291-
* When adding support for direct IO, update {@link org.apache.cassandra.service.StartupChecks#checkKernelBug1057843}
1290+
* When adding support for Direct I/O, update {@link org.apache.cassandra.service.StartupChecks#checkKernelBug1057843}
12921291
*/
12931292
direct
12941293
}

test/conf/latest_diff.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ memtable_allocation_type: offheap_objects
4646

4747
commitlog_disk_access_mode: auto
4848

49+
background_write_disk_access_mode: direct
50+
4951
trickle_fsync: true
5052

5153
sstable:

test/distributed/org/apache/cassandra/distributed/impl/InstanceConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ private InstanceConfig(int num,
151151

152152
.set("commitlog_disk_access_mode", "auto")
153153

154+
.set("background_write_disk_access_mode", "direct")
155+
154156
.set("trickle_fsync", "true")
155157

156158
.set("sstable", Map.of(

0 commit comments

Comments
 (0)