[runtime] add Blob::write_at_sync#3840
Conversation
Deploying monorepo with
|
| Latest commit: |
34d147e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1dd7b18e.monorepo-eu0.pages.dev |
| Branch Preview URL: | https://andre-runtime-write-at-sync.monorepo-eu0.pages.dev |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
commonware-mcp | 34d147e | May 20 2026, 10:37 PM |
Benchmark resultsTip ✅ PASSED: No benchmark exceeded the regression threshold. Benchmark comparison table
Baseline commit(s): |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c1d7a99. Configure here.
| /// | ||
| /// This is not a durability barrier for previous operations. When it completes, | ||
| /// only the bytes submitted to this call are guaranteed durable. Earlier unsynced | ||
| /// [`Blob::write_at`] or [`Blob::resize`] calls require [`Blob::sync`] to become |
There was a problem hiding this comment.
Is this true? does sync on the blob here also sync other pending writes?
There was a problem hiding this comment.
Yes, this is the only thing that this API guarantees. On Linux where we actually implement this with RWF_SYNC the kernel only guarantees the range written by that specific syscall is durable. On non-Linux where we fallback to write+sync then we'll sync all pending writes, but that's incidental and users shouldn't lean on it. For example, even on non-Linux, if you issue a write_at_sync([]) we early return since there's nothing to write, which avoids syncing previous writes.
There was a problem hiding this comment.
Good to know...I would've definitely messed this up.
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #3840 +/- ##
==========================================
- Coverage 95.73% 95.71% -0.02%
==========================================
Files 473 473
Lines 192489 192842 +353
Branches 4666 4674 +8
==========================================
+ Hits 184280 184588 +308
- Misses 6636 6681 +45
Partials 1573 1573
... and 15 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|

This PR adds
Blob::write_at_sync, a storage API for writing a byte range and making that write durable as part of the same operation. On Linux-backed runtimes this uses per-I/O sync flags where available, while fallback implementations preserve the same logical contract withwrite_atfollowed bysync. Empty writes are accepted as no-ops and do not sync prior writes.The storage benchmark harness now has a
write_syncworkload with a--sync-methodswitch for comparingwrite_at + syncagainstwrite_at_sync.Replaces #3784.
Benchmarks
Benchmarks ran on an AWS EC2 i8g.2xlarge node with local NVMe instance storage, Ubuntu 26.04, and Linux kernel 7.0.0. Each case ran the
write_syncworkload with contiguous writes, 30 seconds, a 256M fixed file, seed 0, and 8 runtime worker threads. Deltas comparewrite_at_syncagainstwrite_at + sync, positive throughput delta meanswrite_at_syncis faster, and positive p95 delta meanswrite_at_synchas lower p95 latency.The concurrent-writer results need one caveat:
write_at + syncis not a strict per-writer durable-write baseline when multiple writers share the same blob. Eachsynccan also flush dirty writes issued by other writers, so some writers may get credit for durability work already forced by a different writer.write_at_syncis range-scoped to the submitted write, so the 8-writer comparison is useful as a shared-blob workload measurement, but it is not a perfectly isolated per-operation comparison between the two durability methods.Summary
write_at_synchelps small writes.XFS
Tokio
Single Writer
write_at + syncMiB/swrite_at_syncMiB/swrite_at + syncp95 uswrite_at_syncp95 usConcurrent Writers (8)
write_at + syncMiB/swrite_at_syncMiB/swrite_at + syncp95 uswrite_at_syncp95 usio_uring
Single Writer
write_at + syncMiB/swrite_at_syncMiB/swrite_at + syncp95 uswrite_at_syncp95 usConcurrent Writers (8)
write_at + syncMiB/swrite_at_syncMiB/swrite_at + syncp95 uswrite_at_syncp95 usext4
Tokio
Single Writer
write_at + syncMiB/swrite_at_syncMiB/swrite_at + syncp95 uswrite_at_syncp95 usConcurrent Writers (8)
write_at + syncMiB/swrite_at_syncMiB/swrite_at + syncp95 uswrite_at_syncp95 usio_uring
Single Writer
write_at + syncMiB/swrite_at_syncMiB/swrite_at + syncp95 uswrite_at_syncp95 usConcurrent Writers (8)
write_at + syncMiB/swrite_at_syncMiB/swrite_at + syncp95 uswrite_at_syncp95 us