Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a GPU Worker Messaging Protocol

Design a bounded peer-message protocol for GPU workers, with ordered receipt, retry behavior, restart detection, and overload control.

Problem statement

For this exercise, assume GPU workers exchange small opaque control messages directly with named peer workers inside one cluster.

The messaging layer owns framing, peer identity, local admission, ordered delivery into the receiver's in-memory handler queue, and a receipt result; it does not execute the message's business operation. Each direction between two worker incarnations has a session and monotonically increasing message sequence.

A surviving session must enqueue each accepted sequence at most once and in order, even when receipt acknowledgements are lost and messages are retried. A receipt means the payload was enqueued in volatile memory, not durably stored or successfully executed.

A caller may stop waiting after 30 seconds; an unacknowledged timeout is an unknown outcome and must not be described as proof that the receiver did nothing. Workers can restart or temporarily lose connections.

A restart creates a new incarnation, ends its old sessions, and may lose queued content; old-session frames must not be accepted into a replacement worker. Reconnection may resume a session only when both original incarnations and their session state remain available.

Bound both queued bytes and outstanding messages and expose admission rejection when capacity is exhausted. Design the session and message contracts, peer agents, state ownership, retry and acknowledgement behavior, recovery, and overload handling.

Assume a supplied authenticated peer directory; enrollment and identity issuance are outside scope. Also exclude tensor transfers, collective operations such as all-reduce, GPU kernels, durable message storage, global ordering, and exactly-once business execution.

What to build

  1. A worker can send a bounded opaque payload to a named peer, receive a local admission decision, and later learn a receiver receipt or an explicitly unknown outcome.
  2. A surviving session delivers accepted messages into the receiver queue in sequence, at most once per sequence, despite duplicate sends and lost acknowledgements.
  3. Workers can reconnect with preserved session state, or detect a peer restart and terminate the old session without delivering its stale frames.
  4. The protocol rejects or delays local admission before exceeding its byte and message budgets and exposes queue pressure and stalled sends.

At scale

  • For this exercise, assume 100 GPU workers in one cluster and 2,000 messages per second in aggregate, with opaque payloads of at most 64 KiB.
  • For this exercise, target 20 milliseconds p95 for a receiver receipt on a healthy uncongested cluster; a caller stops waiting after at most 30 seconds.
  • For this exercise, permit at most 128 outstanding messages in one session direction and at most 64 MiB of queued and retained payload bytes per worker across all peers.
  • For this exercise, protocol state is volatile; a worker restart can lose queued messages and must invalidate every session bound to its previous incarnation.