Rooms: fan out updates before the history fsync (keep durability acks) #32

Closed
opened 2026-10-13 17:01:37 +00:00 by kayg · 2 comments
Owner

Today a room fsyncs each incoming update into history.db before fanning it out to the other clients. On a slow or busy disk, collaborators see each other's typing only after that fsync (found while fixing the fuzz test in #31).

Proposal (y-websocket's approach): fan out first, persist right after, while keeping every durability promise:

  • the file on disk is still written only after history is safe
  • API answers and the client's "Saved" ack still wait for durability
  • a crash between fan-out and fsync loses nothing a client hasn't still got (clients hold unacked updates and resend)

Needs: a kill -9 test in that window, the fuzz suite green, and a perf gate on collaborator-visible latency under disk load.

Today a room fsyncs each incoming update into history.db **before** fanning it out to the other clients. On a slow or busy disk, collaborators see each other's typing only after that fsync (found while fixing the fuzz test in #31). Proposal (y-websocket's approach): fan out first, persist right after, while keeping every durability promise: - the file on disk is still written only after history is safe - API answers and the client's "Saved" ack still wait for durability - a crash between fan-out and fsync loses nothing a client hasn't still got (clients hold unacked updates and resend) Needs: a kill -9 test in that window, the fuzz suite green, and a perf gate on collaborator-visible latency under disk load.
Author
Owner

PR open: #82. Collaborator latency under disk load p50 14 ms -> 0.2 ms; burst throughput ~200x; Saved still waits for one fsync. Kill -9 test in the fan-out window passes.

PR open: https://git.kayg.org/kayg/calternal/pulls/82. Collaborator latency under disk load p50 14 ms -> 0.2 ms; burst throughput ~200x; Saved still waits for one fsync. Kill -9 test in the fan-out window passes.
Author
Owner

PR open: #83. Collaborator latency under disk load p50 14 ms -> 0.2 ms; burst throughput ~200x; Saved still waits for one fsync. Kill -9 test in the fan-out window passes.

PR open: https://git.kayg.org/kayg/calternal/pulls/83. Collaborator latency under disk load p50 14 ms -> 0.2 ms; burst throughput ~200x; Saved still waits for one fsync. Kill -9 test in the fan-out window passes.
kayg closed this issue 2026-10-13 21:56:18 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#32
No description provided.