Skip to content

[serve][release] Add HAProxy variant to throughput-optimized serve microbenchmarks - #63386

Merged
kouroshHakha merged 5 commits into
ray-project:masterfrom
kouroshHakha:kh/serve-microbench-haproxy-variant
May 21, 2026
Merged

kouroshHakha merged 5 commits into
ray-project:masterfrom
kouroshHakha:kh/serve-microbench-haproxy-variant

Conversation

@kouroshHakha

Copy link
Copy Markdown
Contributor

Summary

Adds a .aws.haproxy variation to pytest_serve_throughput_optimized_microbenchmarks in release/release_tests.yaml so the nightly throughput-optimized microbenchmark signal exercises the HAProxy proxy in addition to the default Python ProxyActor.

Motivation

Today none of the request-path microbenchmark variants under pytest_serve_*microbenchmarks set RAY_SERVE_ENABLE_HA_PROXY=1, so the nightly benchmark numbers only reflect the Python proxy path. That means latency / throughput regressions specific to the HAProxy code path — or to its tunables like RAY_SERVE_HAPROXY_TCP_NODELAY (recently flipped on by default in #63353) — do not surface in the nightly signal.

The new aws.haproxy variation re-uses the same single-node 16-CPU compute and the same --run-all invocation, just toggling RAY_SERVE_ENABLE_HA_PROXY=1 in runtime_env. Existing throughput-optimized env vars are preserved in the variation's runtime_env (variation env lists replace rather than merge, mirroring the pattern in serve_controller_benchmark_haproxy.aws.pip_haproxy).

Test plan

  • Verified the variation pattern against existing .aws.haproxy variations on pytest_serve_scale_replicas, pytest_serve_multi_deployment_1k_noop_replica, pytest_serve_autoscaling_load_test, and pytest_serve_resnet_benchmark.
  • Verified env-list re-listing against serve_controller_benchmark_haproxy.aws.pip_haproxy (variants replace, not merge).
  • Once merged, the next nightly will produce pytest_serve_throughput_optimized_microbenchmarks.aws.haproxy results; a one-off manual trigger from the BK release pipeline before merge can confirm the run wires up cleanly.

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new test variation, aws.haproxy, to the release/release_tests.yaml configuration. This variation defines a BYOD cluster environment with specific Ray Serve settings, including throughput optimization, a reduced draining period, increased gRPC message length, and the enablement of HAProxy. There are no review comments to address, and I have no feedback to provide.

@akyang-anyscale

Copy link
Copy Markdown
Contributor

does this pass? i tried this before but grpc is not implemented so the release test always fails

@kouroshHakha

kouroshHakha commented May 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Release benchmark runs

Run A v2: pytest_serve_throughput_optimized_microbenchmarks.aws.haproxy (HTTP/handle/streaming only)

https://buildkite.com/ray-project/release/builds/93081

runtime_env: RAY_SERVE_THROUGHPUT_OPTIMIZED=1, RAY_SERVE_DIRECT_INGRESS_MIN_DRAINING_PERIOD_S=0.01, RAY_SERVE_REPLICA_GRPC_MAX_MESSAGE_LENGTH=10500000, RAY_SERVE_ENABLE_HA_PROXY=1.

Script: python workloads/microbenchmarks.py --run-http --run-handle --run-latency --run-throughput --run-streaming (note: --run-grpc omitted — HAProxy is HTTP-only and does not proxy gRPCOptions(port=9000); the prior v1 attempts on build 93066 crashed on the first gRPC call).

Run B: pytest_serve_throughput_optimized_microbenchmarks.aws (baseline, Python ProxyActor)

https://buildkite.com/ray-project/release/builds/93065

runtime_env: same as above without RAY_SERVE_ENABLE_HA_PROXY. Runs the full --run-all (including gRPC, since the Python proxy serves gRPC natively).

The perf_metrics diff will be posted as a follow-up comment once both finish.

@kouroshHakha

Copy link
Copy Markdown
Contributor Author

Benchmark results: HAProxy vs baseline (Python ProxyActor)

Both runs on the same hardware and the same commit logic:

Δ is haproxy − baseline; negative % ⇒ HAProxy is faster / lower / lower variance. 24 gRPC metrics are present only in baseline (HAProxy is HTTP-only, so those columns are intentionally blank — that's the whole reason for the YAML override here).

Where HAProxy moves the dial

Metric Baseline HAProxy Δ
http_10mb_p50_latency 2.87 ms 4.71 ms +64.0%
http_10mb_p90_latency 2.97 ms 5.05 ms +70.2%
http_10mb_p95_latency 3.01 ms 5.84 ms +94.2%
http_10mb_p99_latency 4.31 ms 8.39 ms +94.6%
http_1mb_p90_latency 0.88 ms 1.48 ms +67.5%
http_1mb_p99_latency 0.98 ms 1.57 ms +59.3%
http_p99_latency (small) 0.88 ms 0.94 ms +7.1%
http_streaming_p99_latency 10.64 s 10.91 s +2.6%
http_streaming_avg_tps 47 392 46 509 −1.9%
http_streaming_throughput_std 249.3 480.3 +92.6%
http_intermediate_streaming_throughput_std 82.0 272.4 +232%
handle_* (in-process; no proxy hop) — — ±0.5–8% (noise band)

Reading

  • HAProxy adds a measurable HTTP hop cost. Small-payload p99 +7%; 1 MB p99 +59%; 10 MB p99 nearly 2×. Expected: requests now traverse client → HAProxy → replica instead of client → replica directly.
  • Streaming under HAProxy is ~2-3% slower on mean latency and ~2% lower on tps, and the throughput becomes noticeably more variable (std-dev roughly doubles for streaming, +232% for intermediate_streaming). Mirrors the directional finding from PR [serve] Default RAY_SERVE_HAPROXY_TCP_NODELAY to 1 #63353.
  • handle_* metrics shift within roughly ±5–8% despite the handle path not touching the proxy at all. Take those as noise floor / cluster variance, not a real HAProxy effect.
  • gRPC metrics are intentionally absent from the haproxy run. The variant's script: override drops --run-grpc because HAProxy is HTTP-only and doesn't proxy gRPCOptions(port=9000); before this fix the variant crashed at the first gRPC call. Comparison vs baseline is therefore HTTP/handle/streaming-only by design.

What this PR is worth merging for

It surfaces all of the above as a regression-trackable signal in the nightly. Today none of the request-path microbenchmark variants exercise HAProxy at all — so any regression in the HAProxy proxy code path (or in shared tunables like RAY_SERVE_HAPROXY_TCP_NODELAY) would not show up.

🤖 Generated with Claude Code

Comment thread release/release_tests.yaml Resolved
kouroshHakha and others added 3 commits May 20, 2026 21:09
…crobenchmarks

Adds a `.aws.haproxy` variation to
`pytest_serve_throughput_optimized_microbenchmarks` so the nightly
throughput-optimized signal exercises the HAProxy proxy in addition to
the default Python ProxyActor. Mirrors the existing `.aws.haproxy`
pattern used on other serve release tests.

Without this, none of the nightly request-path microbenchmark coverage
runs against HAProxy, so latency/throughput regressions specific to the
HAProxy code path (or to its tunables like RAY_SERVE_HAPROXY_TCP_NODELAY)
do not surface in the nightly signal.

Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: akyang-anyscale <[email protected]>
HAProxy is HTTP-only and does not proxy the gRPC server that
`pytest_serve_throughput_optimized_microbenchmarks --run-all` binds via
`gRPCOptions(port=9000, ...)`. Under `RAY_SERVE_ENABLE_HA_PROXY=1`, the
gRPC client connection to `127.0.0.1:9000` is refused as soon as
`--run-all` finishes the HTTP phases and transitions into the gRPC
suite, and the workload crashes:

  grpc._channel._InactiveRpcError: status = StatusCode.UNAVAILABLE
  details = "failed to connect to all addresses; last error: UNKNOWN:
  ipv4:127.0.0.1:9000: Failed to connect to remote host: connect:
  Connection refused (111)"

Override `run.script` on the `.aws.haproxy` variation to invoke the
explicit transport flags
(`--run-http --run-handle --run-latency --run-throughput --run-streaming`)
so only the HAProxy-proxied transports are exercised. The plain
`.aws` variant is unchanged and continues to run `--run-all`.

Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: akyang-anyscale <[email protected]>
Adds RAY_SERVE_LLM_ENABLE_DIRECT_STREAMING=1 to the haproxy variant's
runtime_env and --run-direct-streaming to the command line, so the
nightly haproxy row exercises the optimal-latency configuration end to
end: HAProxy + TCP_NODELAY=1 (default in ray-project#63353) + THROUGHPUT_OPTIMIZED=1
+ direct streaming via ingress_request_router bypass.

Depends on ray-project#63391, which defines --run-direct-streaming and
DirectStreamingRouter. Without ray-project#63391 merged, this command line will
fail at click parse time.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Signed-off-by: akyang-anyscale <[email protected]>
@akyang-anyscale
akyang-anyscale force-pushed the kh/serve-microbench-haproxy-variant branch from 14b681c to 47fe772 Compare May 20, 2026 21:09

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 47fe772. Configure here.

Comment thread release/release_tests.yaml Resolved
Signed-off-by: akyang-anyscale <[email protected]>
Signed-off-by: akyang-anyscale <[email protected]>
@akyang-anyscale

Copy link
Copy Markdown
Contributor

benchmarks:

metric baseline haproxy delta
http_p50_latency 0.783 0.808 +3.239%
http_p90_latency 0.820 0.868 +5.830%
http_p95_latency 0.844 0.892 +5.619%
http_p99_latency 0.912 0.970 +6.469%
http_1mb_p50_latency 0.857 0.889 +3.724%
http_1mb_p90_latency 0.886 0.945 +6.667%
http_1mb_p95_latency 0.897 0.967 +7.827%
http_1mb_p99_latency 1.035 1.059 +2.307%
http_10mb_p50_latency 2.793 2.871 +2.777%
http_10mb_p90_latency 2.903 2.988 +2.935%
http_10mb_p95_latency 2.946 3.033 +2.960%
http_10mb_p99_latency 3.044 3.138 +3.086%
http_avg_rps 2843.820 2935.090 +3.209%
http_model_comp_avg_rps 1429.710 1440.730 +0.771%
http_100_max_ongoing_requests_avg_rps 2829.900 2897.630 +2.393%
http_model_comp_100_max_ongoing_requests_avg_rps 1572.170 1599.060 +1.710%
http_800_max_ongoing_requests_avg_rps 2226.660 2212.010 -0.658%
http_model_comp_800_max_ongoing_requests_avg_rps 1319.980 1290.150 -2.260%
http_streaming_avg_tps 47424.300 46813.580 -1.288%
http_streaming_p50_latency 10496.042 10611.438 +1.099%
http_streaming_p90_latency 10527.362 10817.339 +2.754%
http_streaming_p95_latency 10536.201 10823.400 +2.726%
http_streaming_p99_latency 10610.636 10833.191 +2.097%
http_intermediate_streaming_avg_tps 12975.550 12968.360 -0.055%
http_intermediate_streaming_p50_latency 11526.763 11523.420 -0.029%
http_intermediate_streaming_p90_latency 11706.411 11737.090 +0.262%
http_intermediate_streaming_p95_latency 11716.714 11761.086 +0.379%
http_intermediate_streaming_p99_latency 11748.594 11772.638 +0.205%

@akyang-anyscale akyang-anyscale added the go add ONLY when ready to merge, run all tests label May 21, 2026
@kouroshHakha
kouroshHakha merged commit 6fad5ad into ray-project:master May 21, 2026
4 checks passed
alexandrplashchinsky pushed a commit to alexandrplashchinsky/ray-alex that referenced this pull request May 29, 2026
…crobenchmarks (ray-project#63386)

Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: akyang-anyscale <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Co-authored-by: akyang-anyscale <[email protected]>
Signed-off-by: Alexandr Plashchinsky <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…crobenchmarks (ray-project#63386)

Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: akyang-anyscale <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Co-authored-by: akyang-anyscale <[email protected]>
Signed-off-by: 400Ping <[email protected]>
akyang-anyscale added a commit that referenced this pull request Oct 6, 2026
…ptimized variant (#66771)

## Description

The `aws.haproxy` variant of
`pytest_serve_throughput_optimized_microbenchmarks` overrode the script
to skip `--run-grpc`, because HAProxy did not proxy gRPC when the
variant was added (#63386). HAProxy has proxied gRPC since #63735, so
this PR removes the override. The variant now inherits the base
`--run-all` script and runs the gRPC latency and throughput benchmarks
the same way the non-HAProxy variant does.


**Latency**

| Scenario | p50 | p90 | p95 | p99 |
|---|---:|---:|---:|---:|
| http | 0.808204 | 0.861002 | 0.884248 | 0.965185 |
| http_1mb | 0.916350 | 0.960832 | 0.979879 | 1.035858 |
| http_10mb | 2.923250 | 3.028106 | 3.064171 | 3.147383 |
| http_streaming | 10606.518767 | 10727.092702 | 10782.166075 |
10793.441756 |
| http_intermediate_streaming | 11520.631168 | 11709.328922 |
11783.598146 | 11794.278803 |
| grpc | 0.329592 | 0.359457 | 0.374129 | 0.419050 |
| grpc_1mb | 2.914066 | 3.262638 | 3.301536 | 3.536366 |
| grpc_10mb | 28.468160 | 29.396314 | 29.621062 | 33.389895 |
| handle | 0.496363 | 0.535661 | 0.563960 | 0.684138 |
| handle_1mb | 1.240247 | 1.785575 | 2.186740 | 2.772050 |
| handle_10mb | 20.357473 | 24.710342 | 26.734965 | 34.078222 |
| handle_choose_dispatch | 1.365623 | 1.479252 | 1.537067 | 1.765258 |
| handle_streaming | 11385.084532 | 11440.792105 | 11521.717464 |
11530.988577 |

**Throughput**

| Scenario | Average | Standard deviation | Rate |
|---|---:|---:|---|
| http | 3170.64 | 71.61 | RPS |
| http_model_comp | 1532.82 | 10.25 | RPS |
| http_100_max_ongoing_requests | 3179.71 | 73.90 | RPS |
| http_model_comp_100_max_ongoing_requests | 1849.08 | 23.66 | RPS |
| http_800_max_ongoing_requests | 2445.74 | 54.76 | RPS |
| http_model_comp_800_max_ongoing_requests | 1567.39 | 22.87 | RPS |
| http_streaming | 46990.46 | 436.22 | TPS |
| http_intermediate_streaming | 12994.40 | 152.01 | TPS |
| grpc | 4476.50 | 40.00 | RPS |
| grpc_model_comp | 1791.69 | 11.26 | RPS |
| grpc_100_max_ongoing_requests | 4498.49 | 41.80 | RPS |
| grpc_model_comp_100_max_ongoing_requests | 1840.62 | 11.83 | RPS |
| grpc_800_max_ongoing_requests | 4622.03 | 58.40 | RPS |
| grpc_model_comp_800_max_ongoing_requests | 1841.71 | 18.64 | RPS |
| handle | 3504.46 | 46.10 | RPS |
| handle_model_comp | 1020.17 | 25.20 | RPS |
| handle_100_max_ongoing_requests | 3539.55 | 41.45 | RPS |
| handle_model_comp_100_max_ongoing_requests | 1691.89 | 9.40 | RPS |
| handle_800_max_ongoing_requests | 3470.64 | 44.36 | RPS |
| handle_model_comp_800_max_ongoing_requests | 1633.69 | 10.54 | RPS |
| handle_streaming | 13147.51 | 57.50 | TPS |

Signed-off-by: akyang-anyscale <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests release-test release test serve Ray Serve Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants