Skip to content

FEC object batching: amortize the ~24µs RaptorQ per-object setup across N packets #27

Description

@vxfemboy

Design: docs/superpowers/specs/2026-07-03-fec-object-batching-design.md.

RaptorQ Encoder::new pays its full intermediate-symbol solve (~24 µs/packet, ~80% of egress CPU) whenever repair > 0, because yip makes one object per packet. Batching N sealed packets into one object amortizes it to ~24 µs / N.

Key design points (see spec): container = [u16 len][sealed]…; per-packet AEAD counter derived (base+i) so no wire-format change; the accumulator buffers plaintext and seals the batch consecutively at flush so counters stay contiguous (the LossDetector fills counter gaps, so a separate counter space isn't viable); accumulator lives in DataPlane, flushed via a new Dispatch::flush_egress after tick. Bulk-only (Realtime/Default stay batch=1). Defaults N=8, 1 ms flush.

Honest scope: clean links already bypass the encoder (repair == 0), so this helps only the Bulk-under-loss egress path, not clean-link throughput. Gate: arq_recovers_bulk_loss ≥ 98% under batching. Blocked-by review sign-off on the spec's open questions (N, flush deadline, all-or-nothing recovery risk).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions