Update Focal, Jammy to reduce CPU usage of landscape-package-reporter
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Landscape Client |
Fix Committed
|
Undecided
|
Jan-Yaeger Dhillon | ||
landscape-client (Ubuntu) |
Incomplete
|
Undecided
|
Unassigned |
Bug Description
[ Impact ]
* The current implementation of `landscape-
[ Test Plan ]
* Install `python3-psutil` and the proposed version of Landscape Client.
* Replace this line in `/usr/lib/
* def _compute_
* ...with the following to apply the benchmarking to the function which computes changes in packages to report back to Landscape Server:
def _compute_
import cProfile
import pstats
from datetime import datetime
import psutil
profile = cProfile.Profile()
process = psutil.Process()
result = self.compute_
user_time = end_cpu_times.user - start_cpu_
system_time = end_cpu_
output_path = "/var/lib/
with open(output_path, "a") as fp:
now = datetime.now()
stats = pstats.
return result
def compute_
* Now register the client with Landscape Server and wait for package reporter to run and check the benchmarking results for the proposed version:
* less /var/lib/
* Additionally, make sure that package-reporter can report package information to the server properly.
* In a fresh instance, install the current version of Landscape Client from the main Ubuntu repo for that series and add the benchmarking like before.
* sudo apt update && sudo apt install -y landscape-client python3-psutil
* Connect this client to the same server and wait for package reporter to run, and check the benchmarking results for the current (unmodified) version of Landscape Client:
* less /var/lib/
* The cpu times reported by the proposed version should be significantly less than those of the current version. With these changes, this benchmark ran about 11x faster on Jammy and 15x faster on Focal in my testing. See my full observations in the Other Info section.
[ Where problems could occur ]
* This approach tweaks how package changes are computed, the accuracy/
* This proposed fix gets the archives directly from each package versions rather than getting thing information from the Origin class of the Python apt package. However, the point of this is to check if the given package version matches the format of the security or backport archives, so it's possible that this change could lead to package version candidates being incorrectly skipped/not skipped.
[ Other Info ]
* Benchmarking observations: https:/
* Raw paste for the results from the current version (control) of Landscape Client on Focal: https:/
* Raw paste for the results from the modified (proposed) of Landscape Client on Focal: https:/
* Raw paste for the results from the current version (control) of Landscape Client on Jammy: https:/
* Raw paste for the results from the modified (proposed) of Landscape Client on Jammy: https:/
* Original LP question/discussion for "High CPU usage of /usr/bin/
* GH PR for the improvement to the performance of package-reporter: https:/
Related branches
- David McLain: Pending requested
- Ubuntu Sponsors: Pending requested
- Canonical Server Reporter: Pending requested
- git-ubuntu import: Pending requested
-
Diff: 1578 lines (+1550/-0)4 files modifieddebian/changelog (+7/-0)
debian/patches/package-reporter-high-cpu.patch (+110/-0)
debian/patches/parse-lsb-output.patch (+1431/-0)
debian/patches/series (+2/-0)
- Andreas Hasenack: Needs Fixing
- David McLain: Pending requested
- Ubuntu Sponsors: Pending requested
- Canonical Server Reporter: Pending requested
-
Diff: 1661 lines (+1634/-0)4 files modifieddebian/changelog (+7/-0)
debian/patches/package-reporter-high-cpu.patch (+110/-0)
debian/patches/parse-lsb-output.patch (+1515/-0)
debian/patches/series (+2/-0)
description: | updated |
description: | updated |
description: | updated |
summary: |
- Update focal, jammy to fix package reporter error when parsing lsb - release + Update focal, jammy to reduce CPU usage for package reporter and fix lsb + output parsing to recognize modules |
summary: |
- Update focal, jammy to reduce CPU usage for package reporter and fix lsb + Update Focal, Jammy to reduce CPU usage for package reporter and fix lsb output parsing to recognize modules |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Changed in landscape-client: | |
assignee: | nobody → Jan-Yaeger Dhillon (jansdhillon) |
status: | New → In Progress |
Changed in landscape-client: | |
status: | In Progress → Fix Committed |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
no longer affects: | landscape-client/trunk |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
summary: |
- Update Focal, Jammy to reduce CPU usage for package reporter and fix lsb - output parsing to recognize modules + Update Focal, Jammy to reduce CPU usage for package reporter |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
summary: |
- Update Focal, Jammy to reduce CPU usage for package reporter + Update Focal, Jammy to reduce CPU usage of landscape-package-reporter |
description: | updated |
description: | updated |
What's the status of this on noble, oracular, and plucky?