[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#764204: apt-cache calls fcntl() on 65536 FDs



Hi,

On 25 May 2015 at 16:58, Julian Andres Klode <jak@debian.org> wrote:
> Those seem to be uncached or on compressed indices, and thus not
> relevant for this bug.

fair enough. Still, even with cached and uncompressed indices a single
apt-cache show takes about 1.6 seconds on jessie and about 1.2 seconds
on wheezy.

>> How about using the O_CLOEXEC flag when opening files?
>
> We do, AFAIK.

Wouldn't that render the fcntl calls superfluous? Also I can't find
any relevant occurences of O_CLOEXEC in the codebase (apart from one
in pkgDPkgPM::StartPtyMagic).

> I'm wondering a bit because show only does about 38 fcntl() calls for
> me, it does not seem to ForkExec() here at all (and I don't know why
> it should do that at all).

Interesting. You haven't set your Apt::ARCHITECTURES to a single arch
by any chance, have you?

> I just tested the closing call, and it took about 4 ms (or 10-12 in
> jessie) for the program to start up, call fcntl() on the 65533  file
> descriptors, and exit. I cannot believe that this is the major
> performance difference you are experiencing between wheezy and jessie.
>
> Anyway, I fixed this in
> http://anonscm.debian.org/cgit/apt/apt.git/commit/?id=870a2b6d683e58c0584bbd3614a76cf25a055928
> to use /proc/self/fd where available. This brings us down to 0.72 ms
> in my optimal test case.

While this version is still a bit slower than the one in wheezy, it is
significantly faster than the one currently in jessie:

Most recent git version:
~ # time apt-cache show mg > /dev/null
apt-cache policy mg > /dev/null  0.01s user 0.00s system 51% cpu 0.015 total

apt 1.0.9.8 (jessie):
~ # time apt-cache show mg > /dev/null
apt-cache show mg > /dev/null  0.01s user 0.04s system 92% cpu 0.061 total

On the docker instance on my laptop with uncompressed indices I'm down
from 2.2s to 1.4s. All in all a noticeable improvement.

Thank you for the quick response; next time I'll make sure to start
testing in time for the stable release.

Best,
Sebastian


Reply to: