Fix updateinfo v2 timeout for RL8 AppStream by filtering prefetch#78
Open
rockythorn wants to merge 1 commit intoresf:mainfrom
Open
Fix updateinfo v2 timeout for RL8 AppStream by filtering prefetch#78rockythorn wants to merge 1 commit intoresf:mainfrom
rockythorn wants to merge 1 commit intoresf:mainfrom
Conversation
The get_updateinfo_v2 endpoint was loading all advisory_packages rows for every matching advisory (all repos, arches, mirrors), then discarding ~95% of them in Python. For RL8 AppStream without a minor_version filter, this meant ~300k rows loaded to produce ~20k, consistently exceeding the 30-second server worker timeout. Fixes: - Use Prefetch with a filtered queryset on advisory__packages so only packages matching the requested repo and supported_product are loaded from the DB - Add composite index on advisory_packages(advisory_id, repo_name, supported_product_id) to support the filtered prefetch query - Add composite index on advisory_affected_products(supported_product_id, major_version, arch) to speed up the initial filter query Closes resf#77
jason-rodri
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
get_updateinfo_v2endpoint was loading alladvisory_packagesrows for every matching advisory (all repos, arches, mirrors), then discarding ~95% of them in Python. For RL8 AppStream without aminor_versionfilter, this meant ~300k rows loaded to produce ~20k, consistently exceeding the 30-second server worker timeout.Changes
Prefetchwith a filtered queryset onadvisory__packagesso only packages matching the requested repo andsupported_productare loaded from the DBadvisory_packages(advisory_id, repo_name, supported_product_id)to support the filtered prefetch queryadvisory_affected_products(supported_product_id, major_version, arch)to speed up the initial filter query20260318000000_add_updateinfo_perf_indexes.sqlto apply the new indexes to productionCloses #77
Testing
Confirmed the endpoint was timing out on production before this fix:
RL8 AppStream x86_64(production, pre-fix)RL8 AppStream aarch64(production, pre-fix)RL8 BaseOS x86_64(production, pre-fix)Local benchmarks were run against a DB restored from the April 2025 production dump (6,905 advisories, 384,990 packages) across three scenarios:
Local benchmarks did not reproduce the same timing differences seen in production. We suspect this is primarily due to local hardware being significantly faster than the Kubernetes cluster production runs on — the local machine's NVMe SSD likely masks the I/O cost that would be more pronounced on production storage under concurrent load.
EXPLAIN ANALYZEgives a more hardware-independent view, showing the new indexes reduce buffer reads by 12x:On production storage where data is less likely to be fully cached in memory, that 12x I/O reduction should translate directly into wall-clock time savings.