Gentoo Archives: gentoo-user

From: Tom Wijsman <TomWij@g.o>
To: realnc@×××××.com
Cc: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Portage performance dropped considerably
Date: Fri, 07 Mar 2014 19:37:19
Message-Id: 20140307203628.1a9365e1@gentoo.org
In Reply to: [gentoo-user] Portage performance dropped considerably by Nikos Chantziaras
1 On Sun, 26 Jan 2014 16:35:43 +0200
2 Nikos Chantziaras <realnc@×××××.com> wrote:
3
4 > Anyone else noticed this yet? Some portage update seems to have made
5 > "emerge -uDN @world" perform about 10 times slower than before. It
6 > used to take seconds, now it takes about 4 minutes only to tell me
7 > that there's nothing to update. And it does that every time, even
8 > directly in succession and with the caches warm.
9 >
10 > Is it just me?
11
12 (TL;DR: It is a known problem and it will be improved.)
13
14 More people experience this, I've seen multiple reports in all the
15 communication channels I can think of so far; besides having been
16 bothered with it myself in the past, but now I'm fine with ~30 seconds.
17
18 === What is going on and what is a cheap solution? ===
19
20 Often this is due to backtracking going mad; Portage keeps trying
21 again, and again, and ... until it has done it for a 10 extra times. And
22 if a single time perhaps takes like 30 seconds, doing it 10 times extra
23 gets you quickly to get to 6 minutes or so. Now imagine 30 times...
24
25 For this reason, I run --backtrack=0 myself; which finishes in half a
26 minute or so, but it needs some more experience to deal with the output
27 that comes after that as you'll need to fix up some things manually.
28 Not to forget --backtrack=0 has some side effects wrt package rebuilds;
29 I don't know the fine details, but was warned about this by others.
30
31 A solution in between would be to use --backtrack=0 and when that isn't
32 satisfied raise it a bit until satisfied; if you can get your
33 --backtrack=0 to work one or another time, you know you won't need
34 --backtrack=10 soon given that your Portage tree is pretty satisfied.
35 When you need to raise it, you will come around with --backtrack=5; and
36 in the case it doesn't you can raise it again, 3 minutes don't hurt.
37
38 So, it can be perceived as a trade-off between "I can quickly do this
39 myself" (given a good understanding of the output) and "Spent some time
40 doing it for me" (if you don't have the time to do it yourself).
41
42 === Why is this becoming worse over time? ===
43
44 Simply put, it's a growth in complexity; we've moved to newer EAPIs
45 that bring newer features, we have packages improving and thus
46 providing more USE flags depending on more, we've got more overlays to
47 pull interesting packages from, as a consequence of the newer EAPIs
48 there are a lot of sub slot dependencies and the list goes on...
49
50 The more options Portage has to consider, the more time it will spend
51 on it; and if after going down a set of options Portage doesn't find a
52 satisfiable state, it has to backtrack with more and/or different
53 options to try again to find another satisfiable state. You can see
54 that the amount of options (= amount of overlays, packages, versions,
55 enabled USE flags, ...) takes a huge toll here (amongst other things).
56
57 To get an idea of what an @world emerge is doing by default, check:
58
59 https://gist.github.com/TomWij/65a61765ea03e6188a35
60
61 This is generated using the output additions from the attachment of:
62
63 http://article.gmane.org/gmane.linux.gentoo.user/272117
64
65 Those whom are interested can also find call tree graphs, although
66 these rather reveal ~2% improvements because huger improvements require
67 an actual understanding of how most code works together; they are here:
68
69 http://dev.gentoo.org/~tomwij/files/portage-2.2.7-python-2.7-backtrack-0.png
70 http://dev.gentoo.org/~tomwij/files/portage-2.2.7-python-2.7-backtrack-0-hot.png
71 http://dev.gentoo.org/~tomwij/files/portage-2.2.7-python-3.3-backtrack-0.png
72
73 (Generated with https://code.google.com/p/jrfonseca/wiki/Gprof2Dot)
74
75 From the output additions you can see that the slot operators (and thus
76 sub slots from the newer EAPIs) take up quite a few time. If you think
77 about what these slot operators are trying to solve, you'll remember
78 something along the lines of `revdep-rebuild` from a while ago. A lot
79 of time we've used to spend in that back in the days has moved towards
80 a cocktail of slot operators and preserved-rebuild.
81
82 So, part of the extra time we experience is just a move of time; but
83 that doesn't make it additional time (unless with lots of backtracking).
84
85 Tried to keep this layman explanation short; as I no longer intend to
86 make this more than a simple explanation, I used to share further
87 details in the past but I do no longer deem them as necessary today.
88
89 Why? Because Portage developer Sebastian Luther (few_) is working on
90 improving this; the results seem promising, so, let's await a Portage
91 release with that before we continue to look into this again.
92
93 === What might be done to improve this? ===
94
95 Read this message (patch in second mail):
96
97 http://thread.gmane.org/gmane.linux.gentoo.portage.devel/4231
98
99 The results look promising; it goes from 9:28 to 1:59, whereas
100 --backtrack=0 is 1:38. In other words, it gets quite close to the time
101 of --backtrack=0 without bringing its disadvantages; as it still does
102 the conflict resolving that backtrack does, but somewhat different.
103
104 (There are some other smaller patches that also spare out time; if you
105 are interested, you can find them by searching for him on the mailing
106 list. However, I think those other patches will be in a release soon.)
107
108 --
109 With kind regards,
110
111 Tom Wijsman (TomWij)
112 Gentoo Developer
113
114 E-mail address : TomWij@g.o
115 GPG Public Key : 6D34E57D
116 GPG Fingerprint : C165 AF18 AB4C 400B C3D2 ABF0 95B2 1FCD 6D34 E57D