Skip to content

Add a backpressure-aware export streaming chunk-size and memory-ceiling benchmark in src/tests/performance/exportStream.perf.test.ts #756

Description

@1nonlypiece

📌 Description

The bulk export pipeline streams NDJSON/gzip, but there is no benchmark
asserting it holds a bounded memory ceiling under backpressure (a slow
client) and that chunk sizing is tuned for throughput. An unbounded buffer here
would let one large export OOM the process.

This issue adds a streaming benchmark asserting bounded memory under
backpressure and measuring throughput across chunk sizes.

Goal: prove export streaming stays within a memory ceiling under a slow
consumer and document the throughput-optimal chunk size.

🎯 Requirements and Context

  • Must simulate a slow consumer and assert peak memory stays bounded.
  • Must measure throughput across chunk sizes and record the chosen value.
  • Must verify gzip and NDJSON framing remain correct under chunking.
  • Must run with bun test.

🛠️ Suggested Execution

1. Fork the repo and create a branch

git checkout -b perf/export-stream-backpressure

2. Implement changes

  • Add src/tests/performance/exportStream.perf.test.ts exercising
    src/services/exportQueue.ts/src/routes/exports.ts.
  • Document the chunk-size choice in docs/exports.md.

3. Test and commit

  • Run with bun test.
  • Cover edge cases: slow consumer memory ceiling, large dataset, gzip framing,
    abort mid-stream.

Example commit message

perf: backpressure-aware export streaming memory benchmark

✅ Guidelines

  • Minimum 95% test coverage on the new/changed lines.
  • Clear, reviewer-friendly documentation.
  • No regressions on existing export streaming.
  • Timeframe: 96 hours.

🏷️ Labels

type-performance · area-backend · type-testing · MAYBE REWARDED · GRANTFOX OSS · OFFICIAL CAMPAIGN

💬 Community & Support

  • Join the Disciplr contributor Discord to coordinate, ask questions, and get
    unblocked fast: https://discord.gg/xvNAvMJf
  • Please introduce yourself in the channel before you start so we can avoid
    duplicate work, pair you with a reviewer, and get your PR merged quickly.
  • Maintainers actively triage this channel and aim for fast, clear, respectful
    reviews — reach out any time you're blocked.

Metadata

Metadata

Assignees

Labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions