]> pere.pagekite.me Git - homepage.git/blob - blog/data/2012-04-06-skolelinux-slowkdenfs.txt
0184f287071b8ff98b3fe3efcb771ce0c6149175
[homepage.git] / blog / data / 2012-04-06-skolelinux-slowkdenfs.txt
1 Title: Why the KDE menu is slow when /usr/ is NFS mounted - and how to fix it
2 Tags: english, debian edu
3 Date: 2012-04-06 22:10
4
5 <p>Recently I have worked on speeding up a Skolelinux installation
6 using LTSP diskless workstations, and in the process I discovered
7 something very surprising. The reason the KDE menu is responding slow
8 when using it for the first time, is due to the way KDE find
9 application icons. I discovered that showing the Multimedia menu
10 would cause more than 20 000 IP packages to be passed between the LTSP
11 client and the NFS server. Most of these were NFS LOOKUP calls,
12 resulting in a NFS3ERR_NOENT response. Looking at the strace of
13 kicker in Lenny (or plasma-desktop i Squeeze - same problem there), I
14 see that the source of these NFS calls are access() system calls. KDE
15 can do hundreds of access() calls to find one icon file. In my
16 example, just finding the mplayer icon required around 230 access()
17 calls.</p>
18
19 <p>The KDE code seem to search for icons using a list of icon
20 directories, and the list of possible directories is large. In
21 (almost) each directory, it look for files ending in .png, .svgz, .svg
22 and .xpm. The result is a very slow KDE menu when /usr/ is NFS
23 mounted, as showing a single sub menu result in thousands of NFS
24 requests. I am not the first one to discover this. I found a
25 <ahref="https://bugs.kde.org/show_bug.cgi?id=211416">KDE bug report
26 from 2009</a> about this problem, and it is still unsolved.</p>
27
28 <p>My solution to speed up the KDE menu was to create a package
29 kde-icon-cache that upon installation will look at all .desktop files
30 used to generate the KDE menu, find their icons, search the icon paths
31 for the file that KDE will end up finding at run time, and copying the
32 icon file to /var/lib/kde-icon-cache/. Finally, I add symlinks to
33 these icon files in one of the first directories where KDE will look
34 for them. This cut down the number of file accesses required to find
35 one icon from several hundred to less than 5, and make the KDE menu
36 almost instantaneous.</p>
37
38 <p>The bug report mention that this do not only affect the KDE menu
39 and icon handling, but also the login process. Not quite sure how to
40 speed up that part.</p>
41
42 <p>If you got feedback on this issue, please contact debian-edu (at)
43 lists.debian.org.</p>