Skip to content

[ci][deps] Downgrade protobuf from 6.33.6 to 5.27.5 to resolve serve's latency regression - #65216

Closed
jeffreywang88 wants to merge 6 commits into
masterfrom
pin-protobuf-4-25-8-ci
Closed

jeffreywang88 wants to merge 6 commits into
masterfrom
pin-protobuf-4-25-8-ci

Conversation

@jeffreywang88

@jeffreywang88 jeffreywang88 commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Pin protobuf to 5.27.5 for Python 3.10–3.11. This is the newest version before the observed grpc.aio 10 MB-message latency regression.

Background

#64257 upgraded protobuf from 4.25.8 to 6.33.6. A local version bisect found that the latency regression begins with protobuf 5.28.0 (details).

protobuf==5.27.5 restores the pre-regression behavior while avoiding the protobuf-4-only dependency stack.

The pin is intentionally limited to Python 3.10–3.11:

  • The affected Serve release benchmark runs on Python 3.10.
  • Python 3.12+ Ray LLM depsets include vllm==0.26.0, which requires protobuf >=5.29.6. Those environments remain on protobuf 6.33.6.

Dependency cascade

Python 3.10–3.11
└─ protobuf==5.27.5
   ├─ TensorFlow 2.20 requires protobuf>=5.28
   │  └─ TensorFlow / TensorBoard / tf-keras==2.19
   │     └─ NumPy==2.1.3 (TensorFlow 2.19 requires NumPy<2.2)
   ├─ grpcio-tools/status 1.75 require protobuf>=6.31.1
   │  └─ grpcio-tools/status==1.71.2 (supports protobuf>=5.26.1,<6)
   └─ databricks-sdk 0.73+ excludes protobuf 5.27
      └─ databricks-sdk==0.72.0

Validation

The all-configs dependency build completed successfully.

Related issue

An upstream protobuf issue is filed with the ray-free grpc.aio reproducer demonstrating the 5.27.0 → 5.28.0 latency regression: protocolbuffers/protobuf#29708.

Additional information

Optional: Add implementation details, API changes, usage examples, screenshots, etc.

@jeffreywang88 jeffreywang88 changed the title [ci][deps] Downgrade protobuf to resolve serve's latency regression [ci][deps] Downgrade protobuf from 6.33.6 to 4.25.8 to resolve serve's latency regression Aug 4, 2026
Signed-off-by: Jeffrey Wang <[email protected]>
Signed-off-by: Jeffrey Wang <[email protected]>

# Conflicts:
#	python/deplocks/base_extra_testdeps/ray-ml-base_extra_testdeps_py3.10.lock
…e locks

Narrow the protobuf 4.25.8 compatibility set (protobuf, OpenTelemetry 1.27,
grpcio-tools/status 1.62.3, TensorFlow 2.19, NumPy 2.1.3, torchft-nightly)
from `python_version < '3.13'` to `python_version < '3.12'`.

Python 3.12 cannot take the pin: the py3.12 rayllm depsets resolve
vllm==0.26.0, which requires protobuf>=5.29.6, so
`ci/compile_llm_requirements.sh` fails to resolve
`rayllm_test_py312_{cpu,cu130}` with protobuf pinned to 4.25.8. All Serve
release tests that exercise the regression (including
pytest_serve_throughput_optimized_microbenchmarks) run on Python 3.10, so
the fix is unaffected by the narrower scope.

requirements_compiled.txt is regenerated under Python 3.11, matching the
interpreter CI uses; the previous revision of this branch was compiled
under 3.12, which silently dropped uvloop/pymars and emitted an unmarked
array-record==0.8.3 that made ml-build-ci_depset_py3.10 unresolvable.

Validation:
- ./ci/ci.sh compile_pip_dependencies (Python 3.11)
- ./ci/compile_llm_requirements.sh
- bazel run //ci/raydepsets:raydepsets -- build --all-configs
all exit 0.

Signed-off-by: Jeffrey Wang <[email protected]>
@jeffreywang88

jeffreywang88 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor Author

I'm not able to figure out what contributes to the remaining ~3 ms gap. From local repro, it seems like the gap is mostly due to run-to-run variance.

{'perf_metric_name': 'handle_10mb_p50_latency', 'perf_metric_value': 19.376406000219504, 'perf_metric_type': 'LATENCY'}
  • Pre-regression: 15-16 ms.
  • Post-regression: 25 ms.

@jeffreywang88

jeffreywang88 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor Author

Tune MALLOC_MMAP_THRESHOLD_: https://buildkite.com/ray-project/release/builds/103886/table

{'perf_metric_name': 'handle_10mb_p50_latency', 'perf_metric_value': 10.067487000014808, 'perf_metric_type': 'LATENCY'}

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

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.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Aug 26, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no more activity in the 14 days
since being marked stale.

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!

@github-actions github-actions Bot closed this Sep 9, 2026
@jeffreywang88 jeffreywang88 added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Sep 10, 2026
@jeffreywang88 jeffreywang88 reopened this Sep 10, 2026
@jeffreywang88 jeffreywang88 added the go add ONLY when ready to merge, run all tests label Sep 10, 2026
@jeffreywang88

jeffreywang88 commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Latest commit 1167d2a: protobuf 5.27.5
{'perf_metric_name': 'handle_10mb_p50_latency', 'perf_metric_value': 11.745353499918565, 'perf_metric_type': 'LATENCY'}
  • Pre-regression: 15-16 ms.
  • Post-regression: 25 ms.

@jeffreywang88 jeffreywang88 changed the title [ci][deps] Downgrade protobuf from 6.33.6 to 4.25.8 to resolve serve's latency regression [ci][deps] Downgrade protobuf from 6.33.6 to 5.27.5 to resolve serve's latency regression Sep 11, 2026
@jeffreywang88
jeffreywang88 marked this pull request as ready for review September 11, 2026 21:18
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

The number of changes in this pull request is too large for Gemini Code Assist to generate a review.

@abrarsheikh abrarsheikh 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.

@jeffreywang88

Copy link
Copy Markdown
Contributor Author

Closing this PR in favor of #66119.

elliot-barn added a commit that referenced this pull request Sep 14, 2026
…ift (#66119)

## Why

Alternative to #65216. Same protobuf pin, same hand-edited requirements,
but the regenerated
locks no longer carry dependency churn that has nothing to do with
protobuf.

#65216 moves **15 packages unrelated to protobuf**:

| package | master | #65216 | locks |
|---|---|---|---|
| `click` | 8.3.2 | 8.4.2 | 80 |
| `packaging` | 26.1 | **25.0** ⬇ | 78 |
| `py-spy` | 0.4.1 | 0.4.2 | 51 |
| `wandb` | 0.26.0 | **0.24.2** ⬇ | 18 |
| `databricks-sdk` (py3.12+) | 0.103.0 | 0.123.0 | 6 |
| `opentelemetry-{api,sdk,semantic-conventions,exporter-prometheus}` |
1.38–1.41 / 0.59b0–0.62b1 | 1.44.0 / 0.65b0 | 7 each |
| `aiofiles`, `more-itertools`, `restrictedpython`, `serpent`, `etils`,
`cmake` | — | — | 2–9 each |

None of these are required by protobuf 5.27.5. They are fossils of the
branch's **first** commit
(`17a586bc08`), which pinned `protobuf==4.25.8; python_version < '3.13'`
— protobuf 4.x across nearly
every supported Python. That re-resolved a large slice of the graph at
once:

```
package             base (= today's master)   after the 4.25.8 commit
click               8.3.2                     8.4.2
packaging           26.1                      25.0
wandb               0.26.0                    0.24.2
opentelemetry-api   1.39.0                    1.27.0
aiofiles, more-itertools, restrictedpython, serpent   present -> dropped
```

The pin was later relaxed to `5.27.5; python_version < '3.12'`, but
pip-compile only re-resolves a
package when its pin becomes *invalid* — and 8.4.2 / 25.0 / 0.24.2 all
still satisfy the relaxed graph.
So they stayed exactly where protobuf 4.x had put them. Verified:
recompiling with the same requirements
inputs and the same 5.27.5 pins returns master's values (`packaging`
26.1, `wandb` 0.26.0, `click` 8.3.2,
`py-spy` 0.4.1), and `click==8.4.2` also resolves cleanly against master
— nothing caps any of them.

## What changed here

Reset every generated artifact — `requirements_compiled.txt`,
`python/deplocks/`,
`release/ray_release/byod/` — to master, then regenerated on top of the
protobuf pins alone:

```
ci/ci.sh compile_pip_dependencies                      # py3.11, pip<25 for pip-tools 7.4.1
bazel run //ci/raydepsets:raydepsets -- build --all-configs
```

Both `pip-compile` and `uv` reuse the versions already in their output
file unless a constraint forces
otherwise, so starting from master's locks confines the diff to what
protobuf 5.27.5 actually requires.

|  | #65216 | this PR |
|---|---|---|
| packages changed | 40 | **21** |
| files changed | 92 | **73** |
| `requirements_compiled.txt` | 128 lines | **26 lines** |

## What remains

Only the protobuf chain:

- **Hand-pinned** (py<3.12): `tensorflow` 2.19.1, `tensorflow-macos`
2.19.1, `tensorboard` 2.19.0,
`tf-keras` 2.19.0, `numpy` 2.1.3, `databricks-sdk` 0.72.0,
`grpcio-tools`/`grpcio-status` 1.71.2,
  `tensorflow-datasets` dropped on Windows
- **Forced transitively** — each declares `protobuf>=6.33.5`:
`google-cloud-compute` 1.48.0,
`google-cloud-filestore` 1.17.0, `google-cloud-secret-manager` 2.29.0,
`grpc-google-iam-v1` 0.14.4
- **Collateral of the TF downgrade**: `tensorflow-io-gcs-filesystem`
appears (a hard dep of TF 2.19.1
on py<3.12; TF 2.20 moved it behind an extra), `pillow` leaves (it
entered via tensorboard 2.20),
and the tfds chain (`array-record`, `promise`, `toml`,
`tensorflow-metadata`) leaves the Windows
  py3.10 locks

## Notes for review

1. **The py3.12+ protobuf pin does not reach the constraints file.**
`requirements_compiled.txt` is a
py3.11 resolution, so `protobuf==6.33.6; python_version >= '3.12'` is
dropped and the only line left
is `protobuf==5.27.5 ; python_version < "3.12"`. Master had `>= "3.11"`,
which did apply. The py3.12/3.13
locks still hold 6.33.6, but nothing pins it any more. Same in #65216 —
inherent to the marker choice.
2. **The numpy cap leaks into shipped images.** `ray_base_deps` is a
`subset` of `ray_base_extra_testdeps`
(`rayimg.depsets.yaml:226`), so py3.10/3.11 base images get numpy 2.1.3
to satisfy a TensorFlow
constraint they do not contain. Worth scoping to the TF-bearing ML
depsets instead.
(TF 2.19.1's `numpy<2.2.0` is a test-matrix cap, not an ABI break — TF
2.19.1 + numpy 2.2.6 passes
dtype bridge, ml_dtypes bfloat16, dlpack, `tf.experimental.numpy`, Keras
fit/save and `tf.data` —
but the resolver still hard-fails on the pair, and pip-compile has no
`--override`, so keeping 2.2.6
   would mean changing how `requirements_compiled.txt` is generated.)
3. **Master's lock set is not self-consistent.** Across 109 lock files
the same package on the same
Python version sits at different versions in different files
(`packaging` on py3.10 is 25.0, 26.0
*and* 26.1). That is why the `keras`/`scipy`/`networkx` reconciliation
in #65216 is not reproduced
here — those locks still disagree with the pins master already declares.
Worth one convergence pass
   on its own PR rather than inside a protobuf fix.
4. **Worth a guard.** `requirements_compiled.txt` is a single
propagation point to all 109 locks, and CI
only checks that it is up to date — nothing flags a pin moving
*backward* against master. A transient
pin during development ratchets values in permanently, which is exactly
what happened here.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Jeffrey Wang <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Jeffrey Wang <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ift (ray-project#66119)

## Why

Alternative to ray-project#65216. Same protobuf pin, same hand-edited requirements,
but the regenerated
locks no longer carry dependency churn that has nothing to do with
protobuf.

ray-project#65216 moves **15 packages unrelated to protobuf**:

| package | master | ray-project#65216 | locks |
|---|---|---|---|
| `click` | 8.3.2 | 8.4.2 | 80 |
| `packaging` | 26.1 | **25.0** ⬇ | 78 |
| `py-spy` | 0.4.1 | 0.4.2 | 51 |
| `wandb` | 0.26.0 | **0.24.2** ⬇ | 18 |
| `databricks-sdk` (py3.12+) | 0.103.0 | 0.123.0 | 6 |
| `opentelemetry-{api,sdk,semantic-conventions,exporter-prometheus}` |
1.38–1.41 / 0.59b0–0.62b1 | 1.44.0 / 0.65b0 | 7 each |
| `aiofiles`, `more-itertools`, `restrictedpython`, `serpent`, `etils`,
`cmake` | — | — | 2–9 each |

None of these are required by protobuf 5.27.5. They are fossils of the
branch's **first** commit
(`17a586bc08`), which pinned `protobuf==4.25.8; python_version < '3.13'`
— protobuf 4.x across nearly
every supported Python. That re-resolved a large slice of the graph at
once:

```
package             base (= today's master)   after the 4.25.8 commit
click               8.3.2                     8.4.2
packaging           26.1                      25.0
wandb               0.26.0                    0.24.2
opentelemetry-api   1.39.0                    1.27.0
aiofiles, more-itertools, restrictedpython, serpent   present -> dropped
```

The pin was later relaxed to `5.27.5; python_version < '3.12'`, but
pip-compile only re-resolves a
package when its pin becomes *invalid* — and 8.4.2 / 25.0 / 0.24.2 all
still satisfy the relaxed graph.
So they stayed exactly where protobuf 4.x had put them. Verified:
recompiling with the same requirements
inputs and the same 5.27.5 pins returns master's values (`packaging`
26.1, `wandb` 0.26.0, `click` 8.3.2,
`py-spy` 0.4.1), and `click==8.4.2` also resolves cleanly against master
— nothing caps any of them.

## What changed here

Reset every generated artifact — `requirements_compiled.txt`,
`python/deplocks/`,
`release/ray_release/byod/` — to master, then regenerated on top of the
protobuf pins alone:

```
ci/ci.sh compile_pip_dependencies                      # py3.11, pip<25 for pip-tools 7.4.1
bazel run //ci/raydepsets:raydepsets -- build --all-configs
```

Both `pip-compile` and `uv` reuse the versions already in their output
file unless a constraint forces
otherwise, so starting from master's locks confines the diff to what
protobuf 5.27.5 actually requires.

|  | ray-project#65216 | this PR |
|---|---|---|
| packages changed | 40 | **21** |
| files changed | 92 | **73** |
| `requirements_compiled.txt` | 128 lines | **26 lines** |

## What remains

Only the protobuf chain:

- **Hand-pinned** (py<3.12): `tensorflow` 2.19.1, `tensorflow-macos`
2.19.1, `tensorboard` 2.19.0,
`tf-keras` 2.19.0, `numpy` 2.1.3, `databricks-sdk` 0.72.0,
`grpcio-tools`/`grpcio-status` 1.71.2,
  `tensorflow-datasets` dropped on Windows
- **Forced transitively** — each declares `protobuf>=6.33.5`:
`google-cloud-compute` 1.48.0,
`google-cloud-filestore` 1.17.0, `google-cloud-secret-manager` 2.29.0,
`grpc-google-iam-v1` 0.14.4
- **Collateral of the TF downgrade**: `tensorflow-io-gcs-filesystem`
appears (a hard dep of TF 2.19.1
on py<3.12; TF 2.20 moved it behind an extra), `pillow` leaves (it
entered via tensorboard 2.20),
and the tfds chain (`array-record`, `promise`, `toml`,
`tensorflow-metadata`) leaves the Windows
  py3.10 locks

## Notes for review

1. **The py3.12+ protobuf pin does not reach the constraints file.**
`requirements_compiled.txt` is a
py3.11 resolution, so `protobuf==6.33.6; python_version >= '3.12'` is
dropped and the only line left
is `protobuf==5.27.5 ; python_version < "3.12"`. Master had `>= "3.11"`,
which did apply. The py3.12/3.13
locks still hold 6.33.6, but nothing pins it any more. Same in ray-project#65216 —
inherent to the marker choice.
2. **The numpy cap leaks into shipped images.** `ray_base_deps` is a
`subset` of `ray_base_extra_testdeps`
(`rayimg.depsets.yaml:226`), so py3.10/3.11 base images get numpy 2.1.3
to satisfy a TensorFlow
constraint they do not contain. Worth scoping to the TF-bearing ML
depsets instead.
(TF 2.19.1's `numpy<2.2.0` is a test-matrix cap, not an ABI break — TF
2.19.1 + numpy 2.2.6 passes
dtype bridge, ml_dtypes bfloat16, dlpack, `tf.experimental.numpy`, Keras
fit/save and `tf.data` —
but the resolver still hard-fails on the pair, and pip-compile has no
`--override`, so keeping 2.2.6
   would mean changing how `requirements_compiled.txt` is generated.)
3. **Master's lock set is not self-consistent.** Across 109 lock files
the same package on the same
Python version sits at different versions in different files
(`packaging` on py3.10 is 25.0, 26.0
*and* 26.1). That is why the `keras`/`scipy`/`networkx` reconciliation
in ray-project#65216 is not reproduced
here — those locks still disagree with the pins master already declares.
Worth one convergence pass
   on its own PR rather than inside a protobuf fix.
4. **Worth a guard.** `requirements_compiled.txt` is a single
propagation point to all 109 locks, and CI
only checks that it is up to date — nothing flags a pin moving
*backward* against master. A transient
pin during development ratchets values in permanently, which is exactly
what happened here.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Jeffrey Wang <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Jeffrey Wang <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devprod go add ONLY when ready to merge, run all tests serve Ray Serve Related Issue unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants