Skip to content

PYTHON-6135 Fix perf regression by explicitly choosing the python binary - #3086

Merged
blink1073 merged 2 commits into
mongodb:mainfrom
blink1073:PYTHON-6135
Oct 2, 2026
Merged

blink1073 merged 2 commits into
mongodb:mainfrom
blink1073:PYTHON-6135

Conversation

@blink1073

@blink1073 blink1073 commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

PYTHON-6135

Changes in this PR

PYTHON-6084 bound the performance-benchmarks venv to the unoptimized toolchain python instead of uv's optimized managed build, causing BSON/JSON benchmarks to regress 12–30%.

Perf tasks now pin UV_PYTHON=3.10.11 + UV_PYTHON_PREFERENCE=only-managed to ensure that the uv binaries are used.

Test Plan

Perf build. I did a spot check of several of the benchmarks and confirmed that the throughput matches previous levels.

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)? N/A
  • Is there test coverage? N/A
  • Is any followup work tracked in a JIRA ticket? If so, add link(s). N/A

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

PYTHON-6084 (dda56d3) made every uv-invoking step source
setup-uv-python.sh, which prefers the toolchain interpreter
(UV_PYTHON_PREFERENCE=system). On the performance-benchmarks variant the
venv created by the "run server" step was bound to the unoptimized
toolchain build (3.10.11 [GCC 11.5.0 Red Hat]) instead of uv's optimized
managed build (3.10.11 [Clang 16.0.3]), and the test step reused it,
regressing CPU-bound benchmarks by 15-30%.

Pin the perf tasks to the managed interpreter in every step that invokes
uv: generate_config.py passes task-level UV_PYTHON and
UV_PYTHON_PREFERENCE=only-managed to the "run server" and "run tests"
functions, setup_tests.py persists that selection in test-env.sh, and
setup-uv-python.sh lets a task-level preference win over the toolchain
defaults. run-tests.sh re-sources setup-uv-python.sh for direct/local
runs.
@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@blink1073

Copy link
Copy Markdown
Member Author

All of the failures are flakes, upstream service outages, or tracked by DRIVERS-3666 (the amazon latest failure).

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The managed interpreter selection is consistently propagated and the generated configuration matches its source.

Review effort: Balanced
Findings: None

What changed in this PR

Pins performance tasks to uv’s optimized managed Python 3.10.11 build, restoring benchmark performance.

Changes:

  • Configures perf tasks with UV_PYTHON_PREFERENCE=only-managed.
  • Preserves task-level Python preferences through setup scripts.
  • Regenerates Evergreen task and function configurations.
File Description
.evergreen/​scripts/​setup-uv-python.sh Preserves task-defined Python preferences.
.evergreen/​scripts/​setup_tests.py Selects managed Python for perf tests.
.evergreen/​scripts/​generate_config.py Adds managed-Python variables to perf tasks.
.evergreen/​run-tests.sh Initializes Python selection for direct runs.
.evergreen/​generated_configs/​tasks.yml Regenerates perf task configuration.
.evergreen/​generated_configs/​functions.yml Passes the preference through Evergreen functions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@blink1073
blink1073 marked this pull request as ready for review October 1, 2026 11:50
@blink1073
blink1073 requested a review from a team as a code owner October 1, 2026 11:50
@blink1073
blink1073 requested a review from aclark4life October 1, 2026 11:50
Comment thread .evergreen/scripts/generate_config.py Outdated
Comment thread .evergreen/scripts/setup_tests.py Outdated
@blink1073
blink1073 requested a review from aclark4life October 2, 2026 00:57

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

LGTM

@blink1073
blink1073 merged commit 5fb089b into mongodb:main Oct 2, 2026
31 of 33 checks passed
@blink1073
blink1073 deleted the PYTHON-6135 branch October 2, 2026 01:02
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.

3 participants