Skip to content

perf: buffer optimizations (sizes, zero-copy, flush) #113

Description

@Yanstart

Context

Parent design: docs/plans/2026-03-18-relay-refactoring-design.md - Stage 5/5
Bottlenecks: 64KB buffers below BDP, .to_vec() copies on non-FEC path, flush() after every TCP write.

Changes

5a. Profile-scaled TCP buffers: 128KB terrestrial, 256KB satellite (cap at diminishing returns)
5b. Zero-copy on non-FEC path: use slice reference instead of .to_vec()
5c. Remove flush() on exit side: TCP kernel flushes naturally
Files: bins/quick-entry/src/tunnel.rs, bins/quick-exit/src/tunnel.rs

Acceptance Criteria

  • TCP buffer sizes scaled per profile
  • No .to_vec() copy when FEC and compression disabled
  • No flush() after each TCP write on exit
  • 351+ tests pass, CI green
  • Proxmox benchmark: +5-10% on top of stages 1-4

Dependencies

Requires #112 (backpressure) merged first. Can be done in parallel with final benchmarks.

Expected Impact

Polish: +5-10% throughput, reduced memory allocations

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceThroughput and latency optimizations

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions