Repository navigation
[DO NOT MERGE] Serve microbenchmark regression investigation - #64934
jeffreywang88 wants to merge 2 commits into
Conversation
…y-project#64742)" This reverts commit 1eab59c. ray-project#64742 made gc.collect()+gc.freeze() run at the end of Replica.initialize, default-on for every replica. It landed 2026-07-14 and first appeared in the 7/18 serve throughput-optimized nightly microbenchmark, where it caused a correlated step-change: broad single-replica no-op throughput jumps (handle / http / grpc / model-comp, every max_ongoing level) AND a handle_10mb median-latency regression. Confirmed by an A/B that toggles RAY_SERVE_FREEZE_GC_ON_STARTUP on the current build (isolating exactly this commit's runtime effect): handle throughput +12-15% across concurrency, model_comp +9%, and handle_10mb p50 +14% / mean +7%. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Jeffrey Wang <[email protected]>
Handle and HTTP throughput improvement investigationTL;DR #64742 improves both throughput and latency -> net-positive change. Throughput-optimized
|
| metric | 7/18 master + #64742 | revert | with #64742 |
|---|---|---|---|
| Throughput (rps) | |||
| http (mo=5) | 3,329.1 | 2,732.7 | +17.9% |
| http_100 | 3,324.3 | 2,659.3 | +20.0% |
| http_800 | 2,619.6 | 2,075.7 | +20.8% |
| handle (mo=5) | 3,534.9 | 2,947.5 | +16.6% |
| handle_100 | 3,595.7 | 2,954.6 | +17.8% |
| handle_800 | 3,446.4 | 2,756.2 | +20.0% |
| grpc (mo=5) | 4,518.5 | 4,464.3 | +1.2% |
| grpc_100 | 4,511.6 | 4,493.2 | +0.4% |
| grpc_800 | 4,582.5 | 4,527.4 | +1.2% |
| http_model_comp | 1,574.9 | 1,355.8 | +13.9% |
| handle_model_comp | 1,024.8 | 945.0 | +7.8% |
| grpc_model_comp | 1,809.5 | 1,660.7 | +8.2% |
| handle_10mb latency (ms) | |||
| handle_10mb p50 | 24.4 | 26.4 | -8.0% |
| handle_10mb p90 | 27.2 | 31.1 | -14.2% |
| handle_10mb p99 | 31.2 | 33.2 | -6.5% |
Throughput-optimized HAProxy .aws.haproxy (gRPC not run under HAProxy)
| metric | 7/18 master + #64742 | revert | with #64742 |
|---|---|---|---|
| Throughput (rps) | |||
| http (mo=5) | 3,295.5 | 2,794.2 | +15.2% |
| http_100 | 3,216.0 | 2,802.1 | +12.9% |
| http_800 | 2,484.8 | 2,008.6 | +19.2% |
| handle (mo=5) | 3,565.4 | 2,963.0 | +16.9% |
| handle_100 | 3,612.8 | 2,954.9 | +18.2% |
| handle_800 | 3,495.3 | 2,786.3 | +20.3% |
| http_model_comp | 1,557.1 | 1,415.8 | +9.1% |
| handle_model_comp | 1,028.3 | 947.4 | +7.9% |
| handle_10mb latency (ms) | |||
| handle_10mb p50 | 24.3 | 25.2 | -3.8% |
| handle_10mb p90 | 28.1 | 29.6 | -5.5% |
| handle_10mb p99 | 31.0 | 38.5 | -23.9% |
Handle 10mb latency regression investigationRunning serve benchmarks with pre- and post- candidate regression, |
Handle_10mb latency regression
Branches differ ONLY by #64257 → any delta is attributable to it. Throughput-optimized
Throughput-optimized HAProxy
Non-optimized
|
| metric | pre #101629 |
post #101630 |
Δ |
|---|---|---|---|
| handle_10mb p50 | 4.56 | 5.24 | +14.8% |
| handle_10mb p99 | 12.41 | 12.93 | +4.2% |
| handle (small) p50 | 1.01 | 1.02 | +1.2% |
| http_10mb p50 | 4.14 | 4.31 | +4.1% |
Why #64742 improves both throughput and latency?A replica holds loaded Python code (functions, classes, module dicts) which contributes most of the GC-tracked objects the cyclic collector has to walk. Freezing skips scanning these frozen immortals — objects that live for the whole process and can never be part of a collectable cycle, so scanning them is pure wasted work. In turn, each GC scan is cheaper. Since GC runs (stop-the-world) on the event-loop thread, cheaper scans free up CPU that the loop can spend serving requests → higher throughput. And because a collection blocks the loop for its whole duration, when one fires mid-request it directly stalls that in-flight request → freezing shrinks that pause, so latency (especially tail) improves. [Under investigation] Why #64257 hurts both latency?It bumped |
|
#64257 upgraded protobuf 4.25.8 → 6.33.6. In throughput-optimized Serve, The full regression begins at protobuf 5.28:
Note: These numbers may differ from the serve perf dashboards because the serve microbenchmark was run locally on different hardware than the release tests. |
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
This pull request has been automatically closed because there has been no more activity in the 14 days Please feel free to reopen or open a new pull request if you'd still like this to be addressed. Again, you can always ask for help on our discussion forum or Ray's public slack channel. Thanks again for your contribution! |
Confirmation (empirical A/B)
Because #64742's entire runtime effect is gated by
RAY_SERVE_FREEZE_GC_ON_STARTUP, toggling that flag on the current build isolates exactly this commitRan locally -- single-replica, no-op, 1 node (
freeze=0reproduces pre-#64742 behavior,freeze=1is current default):Enabling the freeze reproduces both directions: the no-op throughput jump and the
handle_10mbmedian-latency regression.What
Revert #64742. Restores the pre-freeze baseline on all serve request-path benchmarks and removes the
handle_10mblatency regression.Notes
🤖 Generated with Claude Code