-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
None
Description of problem:
A few customer noticed slow performance of `foreman-rake katello:correct_repositories`. As the rake script that is run during every upgrade, the slowness has an impact to any upgrade duration.
E.g. for 5.6k katello repositories, the rake script takes >2 hours. For 2k-ish repos it took 1 hour.
The slowness comes down mainly from
backend_service = repo.backend_service(SmartProxy.pulp_primary!)
because
Katello::Pulp3::Repository.instance_for_type(repo, smart_proxy)
is slow, because
Katello::RepositoryTypeManager.enabled_repository_types
is slow - despite the (re)calculation of `@enabled_repository_types` being quite simple.
Since the property can be calculated just once and stays same over all execution (am I right here..?), we can make the `enabled_repository_types` method much faster by adding there:
def enabled_repository_types(update = true) return @enabled_repository_types unless @enabled_repository_types == {} ### <<<--- add this line if update && pulp_primary&.has_feature?(PULP3_FEATURE) && pulp_primary&.capabilities(PULP3_FEATURE)&.empty? ..
With this change, I got:
- 4.7times faster rake script execution (on the "slow reproducer")
- 2times faster execution on my own "fast as usual Satellite" with 1300 katello repos
Anyway, my change can break some other call flow, but the idea of a fix is evident - dont recalculate some static property value.
How reproducible:
100% on a dedicated reproducer I have (customer backup, will share in private comment)
(and also very evident on any Satellite with >1k katello_repositories - just have many CVs with many repos promoted to many LEs)
Is this issue a regression from an earlier version:
a regression has been noticed by some customer, cant confirm on my own Satellite
Steps to Reproduce:
1. Run `foreman-rake katello:correct:repositories` on a given reproducer. Optionally, run in `foreman-rake` just `Katello::RepositoryTypeManager.enabled_repository_types` - it will run for 0.7ish second. This is run twice for each repo, hence most of the slowness of whole rake script comes from here.
2. Generic reproducer: Have 50ish empty dummy repos, add them to 10ish CVs and promote the CVs to 5ish LEs to have >1k katello_repository entries. Then run the rake script.
Actual behavior:
The script takes >2hours to execute.
Expected behavior:
The script to complete in minutes, not hours.
Business Impact / Additional info:
- relates to
-
SAT-32143 Executing the 'upgrade:run' rake task takes several hours to complete
-
- New
-