Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] performance - aptpkg.latest_version calls apt-cache for every pkg #63982

Closed
nicholasmhughes opened this issue Mar 28, 2023 · 0 comments · Fixed by #63983
Closed

[BUG] performance - aptpkg.latest_version calls apt-cache for every pkg #63982

nicholasmhughes opened this issue Mar 28, 2023 · 0 comments · Fixed by #63983
Assignees
Labels
Bug broken, incorrect, or confusing behavior Execution-Module

Comments

@nicholasmhughes
Copy link
Collaborator

Description
The pkg.latest state calls the pkg.latest_version execution module during the course of operation. When it does that, all pkgs are passed to the pkg.latest_version module at once. However, on Debian machines, the aptpkg.latest_version module which accepts the package list performs a call to apt-cache policy on the command line for every package.

Steps to Reproduce the behavior

# create a list of all installed packages
dpkg -l | grep ^ii | awk '{print $2}' > all_pkgs

# note that the package list is large
wc -l all_pkgs
415 all_pkgs

# time the operation
time salt-call pkg.latest_version $(paste -sd" " all_pkgs)
...
real    0m9.154s
user    0m6.935s
sys     0m2.196s

Expected behavior
The apt-cache policy call can accept the entire package list at once, then the output can be parsed as a whole.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3006.0+0na.6c81943
 
Dependency Versions:
          cffi: 1.15.1
      cherrypy: Not Installed
      dateutil: Not Installed
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
  looseversion: 1.0.3
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.4
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 23.0
     pycparser: 2.21
      pycrypto: 2.6.1
  pycryptodome: 3.17
        pygit2: Not Installed
        Python: 3.7.3 (default, Oct 31 2022, 14:04:00)
  python-gnupg: Not Installed
        PyYAML: 6.0
         PyZMQ: 20.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.3
 
System Versions:
          dist: debian 10 buster
        locale: UTF-8
       machine: x86_64
       release: 4.19.0-23-amd64
        system: Linux
       version: Debian GNU/Linux 10 buster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant