13 635
правок
Изменения
Tdpkg
,Нет описания правки
The '''tdpkg''' shared library is an interesting solution to this problem — a wrapper library that’s used to speed up [http://en.wikipedia.org/wiki/Dpkg dpkg] *.list files loading using either [http://1978th.net/tokyocabinet/ tokyocabinet] or [http://www.sqlite.org sqlite3]. The larger your dpkg database is, the larger will be the speedup you notice.
It currently works for the [http://www.debian.org Debian GNU/Linux] system.
* Grab the sources (git master): https://gitorious.org/lethal-works/tdpkg/archive-tarball/master
* Source code repository: http://gitorious.org/lethal-works/tdpkg
* My mirror: https://github.com/vitalif/tdpkg
= build Build =
'''Requirements''': build-essential, libsqlite3-dev ''(for the sqlite3 backend)'' and libtokyocabinet-dev ''(for the tokyocabinet backend)''
Type <code>make CACHE=sqlite</code> instead for sqlite3 support.
My personal opinion is that all this indexing and caching stuff should be really implemented inside dpkg, but the advantage of a wrapper library like tdpkg is that everyone can use it, instead of just people who patch their dpkg. = Stability = Library is experimental, there is no warranty of any sort on it! In theory it could make your system, in particular, dpkg and apt-get, highly unstable. My usage experience for more than a year, though, tells that tdpkg almost never fails, and when it fails, it doesn’t make any corruption to real dpkg database. All the negative impact is a temporary inability to install some packages while using tdpkg. Such problems are always fixed by running apt-get with tdpkg temporarily disabled. = Usage = Please make a backup copy of your <tt>/var/lib/dpkg/info/ </tt> directory before using starting to use tdpkg.
Manual usage:
<pre>LD_PRELOAD=./libtdpkg.so dpkg ... </pre>
For system-wide usage use an alias put aliases into your <tt>~/.bashrc</tt> (make sure you use the absolute path to libtdpkg.so):
<pre>alias dpkg="LD_PRELOAD=/path/to/libtdpkg.so dpkg"
The cache for both sqlite3 and tokyocabinet is located at '''/var/lib/dpkg/info/tdpkg.cache'''.
= benchmarking Benchmarking =
The operations involved with dpkg database reading are mostly done on the file system. For this reason cleaning up the kernel cache is a must before calling either tdpkg or dpkg:
<pre>echo 1 > /proc/sys/vm/drop_caches</pre>