apfs-sync-bench

command
v0.6.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

apfs-sync-bench

Zero-CGo, zero-sudo macOS NVMe durability micro-benchmark and APFS volume snapshot inspector built with x/apfs.

What It Demonstrates

  • NVMe Durability Sync Modes: Benchmarks 4 KiB writes followed by os.File.Sync() (fsync(2)), apfs.BarrierSync (F_BARRIERFSYNC — ordered writes without a full drive-cache flush), and apfs.FullSync (F_FULLFSYNC — full NVMe drive-cache flush), reporting p50, p95, average latency, ops/sec, and the BarrierSync vs FullSync speedup ratio.
  • Unprivileged APFS Snapshot Listing (apfs.ListSnapshots): Queries local APFS volume snapshots on -mount (default /) via fs_snapshot_list(2) without sudo.

Usage

CGO_ENABLED=0 go run ./examples/kernel/apfs-sync-bench
CGO_ENABLED=0 go run ./examples/kernel/apfs-sync-bench -iters 50 -mount /

Measured Output (Apple M4 Max, CGO_ENABLED=0)

apfs-sync-bench (iters=20, block=4096B, mount=/)

[Part A] NVMe Durability Sync Benchmark (20 x 4 KiB writes)
  Mode                                       p50        p95        Avg      Ops/s
  ----------------------------------- ---------- ---------- ---------- ----------
  os.File.Sync (fsync)                   6.85 ms   11.06 ms    7.57 ms      132.1
  apfs.BarrierSync (F_BARRIERFSYNC)     993.0 µs    2.11 ms    1.19 ms      839.1
  apfs.FullSync (F_FULLFSYNC)            6.58 ms    9.54 ms    6.83 ms      146.4

  BarrierSync vs FullSync speedup: 5.73x (avg 1.19 ms vs 6.83 ms)

[Part B] APFS Volume Snapshots on "/" (unprivileged fs_snapshot_list)
  found 3 snapshot(s)
   1. com.apple.os.update-60587424F5399FC05D957DF05B4D2F65543462495C77AEF520F790FBB57CB212
   2. com.apple.os.update-02FF77665640B8A607804448D767888941E01246F88EB1014EF19C834D403FA784392AF2EE3E2E09C3D5E9B546F9FBA3
   3. com.apple.os.update-MSUPrepareUpdate

Documentation

Rendered for darwin/amd64

Overview

Command apfs-sync-bench benchmarks macOS durability sync primitives (fsync vs F_BARRIERFSYNC vs F_FULLFSYNC) and inspects local APFS volume snapshots via fs_snapshot_list(2) using x/apfs with zero cgo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL