HarperFast / HarperFast/harper-pro

Record locks: measure the Phase 1 cost baseline before the protocol change

Open
#824 1 comment 0 reactions 1 assignee Claimed by @kriszyp View on GitHub
Dominant language
JavaScript
Stars
3
Forks
0
Avg merge
1d 21h
Merged PRs (30d)
80

Description

The design note for the Phase 1 record-lock redesign
([`docs/record-lock-ownership.md`](https://github.com/HarperFast/harper/blob/feat/record-lock-phase1/docs/record-lock-ownership.md)
§10, §14) states this plainly: **no number in it is a benchmark — they are message counts.** The
protocol change should not land before the numbers exist, because the numbers are also the baseline
the new design has to beat.

[#822](https://github.com/HarperFast/harper-pro/pull/822) already carries an enablement gate and a
3-node integration harness, which is where this runs.

## What to measure

Against the Ricart–Agrawala implementation currently on
[HarperFast/harper#2498](https://github.com/HarperFast/harper/pull/2498) + #822, with
`replication.recordLocks` enabled:

1. **Uncontended acquisition latency** — distribution, not a mean, at 3 nodes. The theoretical cost
is `P+1` durable commits and up to `P²−1` frame deliveries per lock; this says what that is in
milliseconds.
2. **Repeat-lock latency on one key from one node.** This is the *before* figure the delegation path
has to collapse to a local key lock, so it is the single most load-bearing number here.
3. **Hot-key handoff throughput** — alternating locks on one key from two nodes, which is the case
both designs pay a full network round for.
4. **Transaction-log bytes and control entries per lock**, including the audit entries. Audit growth
per lock is currently unknown and it bounds how usable the feature is at rate.
5. **Write throughput with the feature off versus absent**, to prove the ungated ordinary-write path
is untouched. §8 of the note requires this and the branch currently violates it — the commit-time
fence walks the whole write set on every commit even with no transport registered.

## What it gates

The protocol change itself: HarperFast/harper-pro#825 (epoch protocol) and
HarperFast/harper#2541 (home ring and delegations). It is independent of every open design
question, so it can start now.

Also worth capturing while the harness is up, since the redesign's steady-state cost is bounded
below by it: the **delegation re-acquisition rate** at candidate lease durations, and the
**cold-key recovery path** cost — the row of the note's cost table that can dominate and is not
amortized.

Refs #438, HarperFast/harper#483

🤖 Filed by Claude Opus 5 on behalf of Kris.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.