Skip to content

Speed up release plan creation - #1278

Merged
anfimovdm merged 1 commit into
AlmaLinux:masterfrom
eabdullin1:release-plan-perf
Nov 9, 2026
Merged

anfimovdm merged 1 commit into
AlmaLinux:masterfrom
eabdullin1:release-plan-perf

Conversation

@eabdullin1

Copy link
Copy Markdown
Contributor

Problem

Creating a release plan takes up to 1–2 minutes on production. Stage timings of the last 30 releases from performance_stats show that Pulp and DB queries take ~1 s and the presence check is usually under 1 s, while 90%+ of the time is spent in the Beholder part of get_release_plan, e.g.:

release packages plan pulp+db presence check
68001 AL8 1122 138 s 0.6 s 35.8 s
67969 AL8 119 116 s 0.3 s 1.1 s
67540 AL8 187 101 s 0.3 s 0.8 s
67541 AL9 1148 76 s 0.6 s 0.4 s

The Beholder part isn't measured on its own, so it is unknown whether the time goes to the Beholder requests or to processing their responses.

Changes

Only changes that don't affect the resulting plan:

  • logging.debug("beholder_cache: %s", str(beholder_cache)) and the same for all packages built multi-megabyte strings on every plan even with INFO logging. The objects are now passed to logging as is, so they are formatted only when DEBUG is on. Same for the keys logged in find_release_repos. Build RPMs is logged at DEBUG instead of INFO.
  • New performance_stats keys: beholder_requests (all Beholder requests, module ones included, summed up), beholder_cache_build and release_repos_matching. They show which part of the Beholder stage is slow before optimizing it further.
  • modules.yaml of all module tasks of a build is downloaded concurrently, each repository once. A failed download is raised only if that template is actually used, so a task that is skipped later can't fail the plan.
  • Dropped db.refresh(new_release) in create_new_release: get_final_release() reads the release right after it, so the refresh only transferred the plan JSON once more.

Tests

New tests/test_unit/test_release_planner.py covers the concurrent modules.yaml download (one request per repository, failures returned instead of raised) and summing up of repeated stages. tests/test_api/test_releases.py and tests/test_unit: 144 passed, 8 skipped.

🤖 Generated with Claude Code

Debug logs built multi-megabyte strings of the whole beholder cache
and all packages on every plan even with INFO logging, because the
objects were passed through str(). Pass them to logging as is.

Download modules.yaml of all module tasks of a build concurrently
instead of one by one, and drop a db.refresh() of the new release that
only re-read its plan before get_final_release() reads it again.

Also measure the beholder part of the plan separately (requests,
cache build and repositories matching), since it takes most of the
plan time and it is not known yet which of them is slow.
@anfimovdm
anfimovdm merged commit 59286d0 into AlmaLinux:master Nov 9, 2026
3 of 4 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.

2 participants