jonnify·bcs /bcs/cache/coherence-by-mint-time/the-job-lane

B4.2 · dive 3 — the job lane

The lane that survives: at-least-once delivery, exactly-once effect.

The same twenty-nine bytes enqueued on EchoMQ's fair lanes, applied by a consumer running Table.coherence_handler/1. The drill is the bus's own crash choreography from Part III, now carrying coherence — the first consumer died holding the job, the reaper returned it, the healer applied it — and the record closes on the chapter's one-row summary: broadcast median 72 us fire-and-forget, job lane median 148 us at-least-once -- the guarantee costs 2.1 times the latency.

Source: content/bcs4.2.md, quoting bcs_rung_4_2_check.out. This dive reads the job-lane derive, the staged kill, F5, the price derive, and F6 — the derived expectation: attempts 2 and exactly one effective drop.

The crash choreography, stepped. The F5 drill over the queue, two consumers, and the :qc table — enqueue, claim, the staged kill, the reap, the heal, the replay. Step through; the readout names each move and quotes the record where it lands.
enqueue · 29 bytes claim · a lease, token 1 reap · the lease expired claim · token 2 apply · one comparison the next read writer when at-least-once matters ecc.coh.qc the queue · Part III's machine consumer 1 dies holding the job the healer consumer 2 · token 2 :qc · L1 drops its stale row L2 · Valkey serves px=107.00
readout · Press step to walk the F5 drill — enqueue, claim, the staged kill, the reap, the heal, and the replay that proves the effect happened exactly once.

Static walk — 1) the writer enqueues the coherence job on ecc.coh.qc · 2) the first consumer claims it — a lease, a fencing token · 3) the staged kill: the consumer dies holding the job; the lease strands it · 4) the reaper returns it · 5) the healer applies it with token 2 — :qc drops its stale row and the next read serves px=107.00 from the shared L2 · 6) the replay answers stale — at-least-once delivery, exactly-once effect.

§1

The transcript

bcs_rung_4_2_check.out · verbatim · this dive reads the derives, the kill, F5, and F6
content/echo_data/runtimes/elixir/bcs_rung_4_2_check.out · verbatim · the job-lane half; the record opens with F1–F4 — the hub holds it wholefrozen
… (F1–F4 and the broadcast derive elided; the full record is frozen on the module hub)
derive (job lane): a consumer crash after claim strands the coherence job on a lease; the reaper returns it, a second consumer applies it with token 2, and reapplication is harmless because newer-wins is a comparison -- expect attempts 2 and exactly one effective drop

01:36:22.839 [error] GenServer #PID<0.203.0> terminating
** (stop) killed
Last message: {:EXIT, #PID<0.202.0>, :killed}
State: %{backoff: 100, buf: "", client_name: nil, connect_timeout: 3000, counters: {:write_concurrency, #Reference<0.595650664.2344747009.170073>}, database: 0, hb_ref: #Reference<0.595650664.2344615937.170091>, heartbeat_ms: 30000, host: {127, 0, 0, 1}, label: :emq, max_pending: 10000, overloads: 0, password: nil, pending: {[], []}, pending_n: 0, port: 6390, protocol: :auto, protocol_live: 3, push_to: nil, pushes: 0, sock: #Port<0.13>}
F5 job lane ok -- the lane that survives: the first consumer died holding the job, the reaper returned it, the healer applied it -- :qc dropped its stale row and now serves px=107.00 from the shared L2 -- the completed job left no row to browse, and replaying the same version answers stale: at-least-once delivery, exactly-once effect
derive (price): the broadcast lane is one wire hop; the job lane pays three to five hops -- enqueue, wake, claim, complete -- so a parked consumer should land its median between 80 us and 2 ms, the same order as the bus's committed 0.3 ms end-to-end median, carrying the guarantee the push cannot
F6 price ok -- the two lanes on one row: broadcast median 72 us fire-and-forget, job lane median 148 us at-least-once -- the guarantee costs 2.1 times the latency, and gates F4 and F5 are the reason a surface pays it
PASS 6/6

The mid-record [error] GenServer … terminating block is the staged consumer kill of the F5 drill — part of the frozen record, not noise around it. The derive line before it states the expectation the gate then asserts: attempts 2 and exactly one effective drop.

§2

The crash choreography

content/bcs4.2.md · What · Decisions

Every part of the drill is Part III machinery doing its committed work — the lease that strands the job when the consumer dies, the reaper that returns it, the second claim that hands token 2. Redelivery is harmless because application is a comparison; the provenance machinery of 3.5 is not even needed here — the version is the provenance. And the completed job left no row to browse: completion deletes on this bus, so the lane's last word is the cache state itself — :qc dropped its stale row and now serves px=107.00 from the shared L2.

The job-lane consumer lives in the application's tree. The table wires its own broadcast subscription — cheap, self-contained, supervision-as-resubscription — but an EchoMQ consumer is a real supervised worker with a lease and a lane, and hiding one inside a cache table would falsify the supervision tree. coherence_handler/1 makes the wiring one line; the tree stays true:

{:ok, _} =
  EchoMQ.Consumer.start_link(
    queue: Coherence.queue("quotes"),
    connector: [port: 6390],
    handler: Table.coherence_handler(:quotes)
  )

The lease, the reaper, and the fencing token under this drill are the machine B3.3 · The State Machine in Lua gated; the enqueue and the idempotent row are B3.2 · Jobs Are Entities's. The job lane adds nothing to either — it carries the twenty-nine bytes across machinery that already proved itself.

§3

The price, on one row

content/bcs4.2.md · What · When · Boundaries

The derive line prices the shape before the stopwatch runs: the broadcast lane is one wire hop; the job lane pays three to five hops — enqueue, wake, claim, complete — so a parked consumer should land its median between 80 us and 2 ms, the same order as the bus's committed 0.3 ms end-to-end median, carrying the guarantee the push cannot. The measurement: broadcast median 72 us fire-and-forget, job lane median 148 us at-least-once -- the guarantee costs 2.1 times the latency.

The two lanes on one row. The committed pair, drawn to scale — both bars always together, because the pair is the figure. Select a reading of the row.
broadcast · fire-and-forget median 72 us job lane · at-least-once median 148 us
readout · Select a reading. The bars are the committed medians drawn to scale — 72 us against 148 us — and the record states what the difference buys.

Both lanes are sub-millisecond on this wire; the real difference is gates F4 and F5, not the microseconds — the lane a surface declares follows from what a stale read costs, and the declaration in the directory records the choice. Declare :job when at-least-once is a requirement — and note what the record shows: the guarantee's latency price on this wire is 76 microseconds, so the job lane is not the slow lane, it is the accountable one. Risk and limits surfaces ride this lane because a stale ceiling is money; quote boards ride broadcast — or nothing — because a TTL was already enough.

Boundaries, stated honestly: the job lane inherits the bus's contract — at-least-once with redelivery, volatile by D-2 — a bus restart loses queued coherence jobs along with everything else, and the TTL is again the floor under the loss. The latencies are this container's: one core, loopback, both lanes far below any network's floor — the ratio and the ordering travel, the microseconds do not. And the applier is the owner — for now: pushes and jobs apply inline in the table's process, which is correct and measured fast; B4.3 · The Single Writer and the Ring moves application onto the ring for batching and backpressure without touching the semantics gated here.

§4

References

sources · related

Sources

Related