Mercurial > hg > Blog
comparison content/Linux/portage-metadata-cache.md @ 58:0cd05745be92
add a blog entry about the portage metadata cache
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sat, 28 Feb 2015 02:42:21 +0100 |
parents | |
children | 0f9fffa05db1 |
comparison
equal
deleted
inserted
replaced
57:7897bdc57faf | 58:0cd05745be92 |
---|---|
1 Title: speeding up portage's metadata cache | |
2 Date: 2015-02-26 | |
3 Lang: en | |
4 | |
5 [Gentoo's](http://www.gentoo.org) portage keeps metadata about installed ebuilds in `/var/cache/edb`. Dependency info for all installed ebuilds is in a `dep` subdirectory which typically looks something like this: | |
6 | |
7 . | |
8 ├── usr | |
9 │ └── portage | |
10 │ ├── app-admin | |
11 │ │ ├── eselect-1.4.1 | |
12 │ │ ├── eselect-lib-bin-symlink-0.1.1 | |
13 │ │ ├── eselect-opengl-1.2.7 | |
14 │ │ ├── gamin-0.1.10-r1 | |
15 │ │ ├── logrotate-3.8.7 | |
16 │ │ └── perl-cleaner-2.16 | |
17 ... | |
18 | |
19 When portage needs to process dependency info, it reads those files. On a normal system, you will have a couple of hundred packages installed. This means that dependency processing does quite a bit of file processing. | |
20 | |
21 Now if that dependency info was stored in some kind of database, wouldn't that speed up dependency processing? | |
22 | |
23 I stumbled over [a wiki page](http://gentoo-en.vfose.ru/wiki/Portage_SQLite_Cache) describing how to switch portage's metadata cache to sqlite. Even the portage man page talks about this - try running `man portage` and read the section about the `modules` file. | |
24 | |
25 So I gave the sqlite metadata cache a try to measure if it really speeds up portage. After configuring the database and rebuilding the metadata cache, `/var/cache/edb/dep` looks a bit different now: | |
26 | |
27 . | |
28 └── usr | |
29 ├── portage | |
30 └── portage.sqlite | |
31 | |
32 Now let's get to the interesting part: does the database really speed up portage? To measure, I ran a couple of `emerge -vp` commands using the normal setup and again using the database. The results are quite disappointing, though: | |
33 | |
34 The best improvement was about 6% with the metadata database. | |
35 | |
36 57% of the ebuilds did run slower with the metadata database, the worst increase was about 43% | |
37 | |
38 So it looks like fiddling with portage's metadata cache is not really worth the hassle. |