performance issue reading in from an rpmdb
November 10, 2011
If you find all rpm and yum operations EXTREMELY slow – even doing simple things like listing all installed pkgs – it would be handy to take a look at the numbers you’re getting.
A bug filed today:
https://bugzilla.redhat.com/show_bug.cgi?id=752897
has been able to replicate it.
However, if you would like to check it on your system in general please run:
time python -c ‘import yum; print len(yum.YumBase().rpmdb.simplePkgList())’
This will spit out a number and then some times. The times are obvious – the number is the total number of pkgs installed on your system - according to your rpmdb.
If the time is beyond like 20s it’s way too slow. On my laptop it is between .12s and .78s.
Seriously – it shouldn’t take very long at all. if it is taking a long time – post your numbers in a comment on this blog post and what ver of rpm you’re using.
thanks
November 10, 2011 at 9:43 pm
Hi Seth,
fortunately, it seems to be ok on my system. BTW: probably doesn’t matter, but I did a fresh install instead of upgrading from F15.
~ time python -c “import yum; print len(yum.YumBase().rpmdb.simplePkgList())”
Loaded plugins: langpacks, presto, refresh-packagekit
1347
real 0m0.248s
user 0m0.144s
sys 0m0.035s
~ rpm -q rpm
rpm-4.9.1.2-1.fc16.x86_64
November 10, 2011 at 10:02 pm
# time python -c ‘import yum; print len(yum.YumBase().rpmdb.simplePkgList())’ ; rpm -q rpm
Loaded plugins: fastestmirror, langpacks, presto, priorities, refresh-packagekit
2253
real 0m0.579s
user 0m0.466s
sys 0m0.112s
rpm-4.9.1.2-1.fc15.x86_64
November 10, 2011 at 10:04 pm
if your numbers are less than 1s then I think that’s just fine
November 10, 2011 at 10:33 pm
Did it twice:
$ time python -c ‘import yum; print len(yum.YumBase().rpmdb.simplePkgList())’
Loaded plugins: auto-update-debuginfo, priorities, refresh-packagekit,
: versionlock
2652
real 0m46.768s
user 0m2.275s
sys 0m1.091s
$ time python -c ‘import yum; print len(yum.YumBase().rpmdb.simplePkgList())’
Loaded plugins: auto-update-debuginfo, priorities, refresh-packagekit,
: versionlock
2652
real 0m1.222s
user 0m0.989s
sys 0m0.219s
Did “echo 3 > /proc/sys/vm/drop_caches” as root and it went to 1m29s
/var/lib/rpm is 304M
This is a RAID1 setup with a 4 core AMD processor and 4G of RAM.
November 10, 2011 at 10:38 pm
1m29s seems high… to me – is that on f16? If so could you add your info to that bug report?
thanks
November 10, 2011 at 10:41 pm
BTW, this is F15 (I missed that this was F16).
rpm –rebuilddb takes the size down to 137M and then (after drop_caches) 58sec
November 11, 2011 at 1:03 am
Loaded plugins: auto-update-debuginfo, langpacks, presto, refresh-packagekit
1900
real 0m14.861s
user 0m0.390s
sys 0m0.316s
/var/lib/rpm is 208M (according to du -su)
Running Fedora 16.
November 11, 2011 at 1:41 am
Loaded plugins: langpacks, presto, refresh-packagekit
1933
real 0m2.202s
user 0m0.664s
sys 0m0.188s
Fedora 16 with rpm-4.9.1.2-1.fc16
November 11, 2011 at 6:02 am
Fedora 16 264M /var/lib/rpm
2402
real 0m16.238s
user 0m1.099s
sys 0m0.533s
November 11, 2011 at 10:30 am
$ rpm -qi rpm|head -4
Name : rpm
Version : 4.9.1.2
Release : 1.fc15
Architecture: i686
$ uname -a
Linux xxx 2.6.40.6-0.fc15.i686.PAE #1 SMP Tue Oct 4 00:44:38 UTC 2011 i686 i686 i386 GNU/Linux
$ time python -c ‘import yum; print len(yum.YumBase().rpmdb.simplePkgList())’
Loaded plugins: fastestmirror, langpacks, local, presto, priorities, refresh-
: packagekit
2242
real 0m0.384s
user 0m0.284s
sys 0m0.096s
November 13, 2011 at 1:06 am
rawhide:
[root@segfault ~]# time python -c ‘import yum; print len(yum.YumBase().rpmdb.simplePkgList())’
Loaded plugins: auto-update-debuginfo, fastestmirror, langpacks, presto,
: refresh-packagekit, rpm-warm-cache, upgrade-helper
2318
real 0m54.300s
user 0m1.193s
sys 0m0.832s
And again (cached!)
[root@segfault ~]# time python -c ‘import yum; print len(yum.YumBase().rpmdb.simplePkgList())’
Loaded plugins: auto-update-debuginfo, fastestmirror, langpacks, presto,
: refresh-packagekit, rpm-warm-cache, upgrade-helper
2318
real 0m0.224s
user 0m0.147s
sys 0m0.043s
November 13, 2011 at 1:08 am
Fedora 15 -> 16 preupgrade box:
[root@coredump ~]# time python -c ‘import yum; print len(yum.YumBase().rpmdb.simplePkgList())’
Loaded plugins: fastestmirror, presto, refresh-packagekit
1943
real 0m43.152s
user 0m2.411s
sys 0m1.896s
And again (cached!)
[root@coredump ~]# time python -c ‘import yum; print len(yum.YumBase().rpmdb.simplePkgList())’
Loaded plugins: fastestmirror, presto, refresh-packagekit
1943
real 0m0.377s
user 0m0.307s
sys 0m0.060s
December 20, 2011 at 9:52 pm
# sync ; echo 3 > /proc/sys/vm/drop_caches
# time python -c ‘import yum; print len(yum.YumBase().rpmdb.simplePkgList())’
Geladene Plugins: auto-update-debuginfo, etckeeper, langpacks, presto,
: priorities, refresh-packagekit
4635
real 0m25.042s
user 0m0.699s
sys 0m0.520s
# rpm -q rpm yum
rpm-4.9.1.2-1.fc16.x86_64
yum-3.4.3-7.fc16.noarch