You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sam Lightfoot (Jira)" <ji...@apache.org> on 2026/07/06 14:32:00 UTC

[jira] [Comment Edited] (CASSANDRA-21487) trickle_fsync is silently ignored for compressed SSTables

    [ https://issues.apache.org/jira/browse/CASSANDRA-21487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18094028#comment-18094028 ] 

Sam Lightfoot edited comment on CASSANDRA-21487 at 7/6/26 2:31 PM:
-------------------------------------------------------------------

Slightly unrelated but interesting nevertheless. Read latency p99 impact of enabling trickle_fsync with the default 10MB flush windows, showing significant dampening via reduction of max disk throughput during flush window. Enalbement complements omission of memtables from direct I/O path to benefit from page cache population.

The 'writeback' is not in trunk and is a local mode which syncs a file range without the durable write barrier (possible as we fsync with barrier after the SSTable has been fully written).

 

!image-2026-07-06-15-28-25-963.png|width=590,height=585!


was (Author: JIRAUSER302824):
Slightly unrelated but interesting nevertheless. Read latency p99 impact of enabling trickle_fsync with the default 10MB flush windows, showing significant dampening via reduction of max disk throughput during flush window. Enalbement complements omission of memtables from direct I/O path to benefit from page cache population.

 

!image-2026-07-06-15-28-25-963.png|width=590,height=585!

> trickle_fsync is silently ignored for compressed SSTables
> ---------------------------------------------------------
>
>                 Key: CASSANDRA-21487
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21487
>             Project: Apache Cassandra
>          Issue Type: Bug
>          Components: Local/SSTable
>            Reporter: Sam Lightfoot
>            Assignee: Sam Lightfoot
>            Priority: Low
>             Fix For: 5.0.x, 6.0.x
>
>         Attachments: image-2026-07-06-15-28-25-963.png
>
>
> h2. What's wrong
> {{trickle_fsync: true}} is meant to fsync a large sequential write at intervals, so a flush trickles its dirty pages to disk instead of dumping them all at once and spiking read latency. On compressed SSTables it does nothing. Compression is the default, so the setting has been silently ignored on the data file of every flush and every buffered compaction.
> h2. Why
> The compressed writer throws the setting away. {{CompressedSequentialWriter.buildOption()}} rebuilds the writer's options and copies only three of them:
> {code:java}
> return SequentialWriterOption.newBuilder()
>                              .bufferSize(parameters.chunkLength())
>                              .bufferType(parameters.getSstableCompressor().preferredBufferType())
>                              .finishOnClose(option.finishOnClose())   // trickleFsync + interval lost here
>                              .build();
> {code}
> {{trickleFsync}} and {{trickleFsyncByteInterval}} never make it through, so the rebuilt option defaults to {{{}trickleFsync = false{}}}. The trickle branch in {{SequentialWriter.doFlush}}
> ({{{}if (option.trickleFsync()) …{}}}) never runs, and no interval fsync ever fires.
> {{IOOptions}} and {{BigTableWriter}} set the options correctly; only the compressed writer drops them. Commit {{fb221095cb}} (June 2016) moved trickle config into the passed-in option but forgot this path. It has been broken since.
> h2. What still works
> The primary index (plain {{{}SequentialWriter{}}}) and uncompressed data files ({{{}ChecksummedSequentialWriter{}}}) pass the option through untouched, so trickle works there. But the index is tiny; the data file is where the bytes and the writeback storm are.
> h2. Fix
> Pass the two fields through:
> {code:java}
>     .trickleFsync(option.trickleFsync())
>     .trickleFsyncByteInterval(option.trickleFsyncByteInterval())
> {code}
> The interval counter in {{doFlush}} already tracks uncompressed bytes correctly; only the enable flag was missing.
> h2. How it was found
> Found while benchmarking flush write-pacing: {{trickle_fsync}} on and off gave an identical dirty window.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org