Mailinglist Archive: opensuse (982 mails)

< Previous Next >
Re: [opensuse] Re: [opensuse-factory] How many seconds does "time rpm -qa | wc" cost it?
On 09/15/2014 08:52 PM, Carlos E. R. wrote:
On 2014-09-15 18:03, Cristian Rodríguez wrote:
That's why rpmqpack exists. because this operation is slow in rotating
media.

Yes, it does run quick here.

Well, it only reads /var/lib/rpm/Name while "rpm -qa" also reads
/var/lib/rpm/Packages ... because the latter command also prints
the version numbers.
Interestingly, "rpm -qa --qf='${NAME}\n'" - which would output the
same as 'rpmqpack' - is still much slower than rpmqpack.

BTW: the slowness comes from the ~30000-50000 pread(2) invocations
reading from /var/lib/rpm/Packages:

$ time strace -c rpm -qa | wc
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
98.21 0.027663 1 33110 pread
0.39 0.000111 1 116 read
0.37 0.000105 0 1869 write
0.32 0.000089 1 114 mmap
0.30 0.000085 1 117 37 open
...
------ ----------- ----------- --------- --------- ----------------
100.00 0.028167 39408 47 total
1869 1869 63019

real 0m14.889s
user 0m0.902s
sys 0m0.847s

If that file is cached, then the rpm command is quite okay:

$ time rpm -qa | wc
1869 1869 63019

real 0m0.500s
user 0m0.476s
sys 0m0.041s

but when the cache is dropped, then the pread()s eat much time
again:

$ sync
$ echo 3 > /proc/sys/vm/drop_caches
$ time rpm -qa | wc
1869 1869 63019

real 0m15.246s
user 0m0.610s
sys 0m0.194s

So the question is if the pread()s could be enhanced/avoided.

[above number from this system: i5-4570, 20G RAM, Hitachi HDS72101]

Have a nice day,
Berny


--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups