Skip to content

perf(connector): optimize prefix load staging pipeline#87

Merged
GentleCold merged 11 commits into
masterfrom
chore/optimize-evict-prefix-l2-l1
Jul 9, 2026
Merged

perf(connector): optimize prefix load staging pipeline#87
GentleCold merged 11 commits into
masterfrom
chore/optimize-evict-prefix-l2-l1

Conversation

@GentleCold

@GentleCold GentleCold commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Use fixed load/store CUDA staging pools so staging memory is allocated once and reused instead of growing dynamically on the hot path.
  • Register fixed load staging buffers with the server and route load RPCs by buffer index to reduce repeated CUDA IPC mapping overhead.
  • Add completion-driven request-level load dispatch so cache-hit requests are queued across scheduler windows and released independently when their load finishes.
  • Parallelize tiered io_uring L2 miss reads and copy each completed miss into the destination as it arrives.

Motivation

Warm prefix TTFT in evict mode is significantly slower than LMCache for the 8192/1, block size 128, c8, 200-request workload. This PR keeps the benchmark-positive load-pipeline changes: bounded staging allocation, registered staging mappings, request-level completion, and request inflight dispatch bounded by fixed staging depth.

Follow-up transfer-side experiments that did not improve this workload were dropped from this branch.

Test plan

  • Unit tests added / updated
  • Integration tests run, or marked N/A with reason
  • Benchmark / e2e smoke run, or marked N/A with reason
  • pre-commit run --all-files passes

Validation run:

  • pytest tests/connector/test_daser_connector.py tests/connector/test_gds_transfer.py tests/connector/test_ipc_client.py -q -> 134 passed
  • pytest tests/transfer/test_tiered_iouring_transfer.py tests/transfer/test_iouring_skip_l2_transfer.py -q -> 30 passed
  • pre-commit run --all-files -> passed

Benchmark evidence, evict mode, block size 128, 8192/1, c8, 200 requests, Qwen3-8B, run id 20260709_140956:

Backend Mode Mean TTFT Median TTFT P99 TTFT Throughput Hit Rate Correctness
baseline - 3996.70ms 4076.85ms 4104.49ms 1.97 req/s - -
LMCache cold 3393.57ms 3410.56ms 3841.73ms 2.32 req/s 0.0 -
LMCache warm 359.53ms 426.15ms 736.84ms 22.00 req/s 1.0 198/200 (0.99)
DaseR prefix cold 3412.53ms 3447.94ms 3632.72ms 2.31 req/s 0.0 -
DaseR prefix warm 539.13ms 536.59ms 691.53ms 14.57 req/s 1.0 198/200 (0.99)

Checklist

  • pre-commit run --all-files passes
  • Type hints and docstrings on all new/modified functions
  • New features and bug fixes include tests
  • No regressions — existing tests still pass

- Add a fixed-size staging pool for load buffers.

- Cover reuse and oversized-request behavior with focused tests.
- Add FIFO helper for fixed-depth load batch submission.

- Cover depth-two submission and buffer reuse order.
- Use two fixed load staging buffers for worker cache-hit loads.

- Overlap server load submission with prior batch restore.

- Preserve FIFO restore ordering and final CUDA synchronization.
- Add IPC support for registering fixed load staging buffers by index.

- Use registered staging buffer indexes on the worker load hot path with a CUDA IPC fallback.

- Cover registered staging RPCs and server mapping reuse in tests.
- Rename the reusable staging pool to store-only terminology.

- Keep load restore paths on the fixed staging pool.

- Update connector tests to use the store staging pool name.
- Reuse one fixed CUDA staging pool implementation for store and load paths.

- Block store staging acquisition on completed store futures instead of allocating dynamically.

- Consume load pipeline batches in completion order with fixed in-flight depth.
- add fixed load IPC clients so staged load batches use independent server connections

- consume io_uring L2 miss reads as they complete and copy each batch to the destination immediately

- cover buffer-scoped load clients and completion-driven L2 miss promotion
- track request-level load futures while preserving grouped load pipeline submission

- mark each request complete after all batches containing it restore into KV cache

- cover independent request load completion and request-id annotated load ranges
- map staging-local split load IDs back to their owning request before updating request-level load futures

- cover split staging completion so async loads cannot leave requests waiting forever
- add a fixed-width worker load queue that groups request loads across scheduler windows

- drive queued loads through the existing load pipeline with request-level completion futures

- cover queued load grouping and pump batching behavior
- replace grouped load queue pumping with request-level max-inflight dispatch

- bound active request loads by fixed staging pool depth and configured inflight limit

- expand fixed load staging registration and IPC lanes for request-level dispatch

- cover immediate dispatch and staging-depth limiting in connector tests
@GentleCold
GentleCold marked this pull request as ready for review July 9, 2026 06:24
@GentleCold
GentleCold merged commit 3713722 into master Jul 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant