CSE Roadmap

Common tier · about 4 hours · 12 parts

Part 6 of 12 · 3 min read

What the example found

The three write-policy comparisons, the contention sweep, the four messaging policies on a lossy channel, and token cost by view.

How to read the write-policy table: each row is one of three write policies, run with six agents doing five rounds each, averaged over 30 seeds. Every agent also adds its cost to a counter and claims a task in its last round.

Policy Items kept of 30 Counter error Retries Model calls Contested claims made visible
last writer wins 5.9 421 0 30 0 of 5
optimistic concurrency 30 0 83 113 5 of 5
merge by operation 30 0 0 30 0 of 5

What to notice: last-writer-wins and merge-by-operation both cost exactly 30 model calls, but only one of them is correct. The cheapest-looking policy on paper is the one silently losing 24 of every 30 items.

How to read the contention table: each column is a different number of concurrent agents; rows compare lost items under last-writer-wins against model calls under the two correct policies.

Agents 2 4 6 12
last writer wins, lost 5 14 24 54
optimistic, model calls 16 54 113 387
merge, model calls 10 20 30 60

What to notice: optimistic concurrency's model calls grow much faster than merge's as agents are added (387 against 60 at twelve agents). Contention itself grows faster than the agent count. So a policy whose cost is driven by retries gets disproportionately more expensive exactly when you add more agents.

How to read the messaging table: each row is a different delivery policy tested on the same 100 messages against the same lossy channel (20% drop, 10% duplicate, 20% acknowledgement loss, 20 seeds).

Policy Missing Repeated effects Messages sent Applied out of order
at most once 20 9 100 14
at least once 0 35 153 43
at least once + idempotency key 0 0 153 27
+ sequence numbers 0 0 153 0

What to notice: every policy from at-least-once onward sends the identical 153 messages. The fixes for duplication and ordering don't cost any additional network traffic. They only change what the receiver does with the messages that already arrive.

How to read the token-cost table: each row is a different view an agent is shown; columns are different agent counts, over five rounds with an 800-token system prompt and 120 tokens per entry.

Agents 2 6 12
whole shared state 13,400 76,200 260,400
scoped view (own entries and the three latest others) 12,920 41,280 83,280
pointers (own entries and one line per other agent) 10,640 34,800 78,240

What to notice: broadcasting the whole state scales roughly with agents squared. It goes from 13,400 to 260,400 as agents go 2 to 12, a 19x rise for a 6x increase in agents. A scoped view scales much closer to linearly. Showing every agent everything is the one choice in this whole module that gets structurally worse, not just more expensive, as the system grows.

At-least-once traffic grows with loss: 124 messages sent per 100 at 0 percent loss, 135 at 10, 153 at 20, 205 at 40.

{{svg:lostupdate|Two agents read the same list; the first write is lost. Three fixes below.}} {{svg:results|Lost items and model calls by policy and agent count; messaging policies on a lossy channel; tokens by the view each agent is given.}}