View previous topic :: View next topic |
Author |
Message |
user11 Tux's lil' helper
Joined: 25 Nov 2005 Posts: 149
|
Posted: Sat Oct 16, 2010 11:56 pm Post subject: revdep-rebuild is slow -- hopes/ideas |
|
|
When I update system, much time is spent on revdep-rebuild. The more CPUs I have, the more noticable is single-threaded revdep-rebuild compared to compiling.
Some ideas ('hopes for ideas', because I did not look into revdep-rebuild sources, so I am not sure if they are possible):
* Allow multiple --library options to search for any of the libraries specified. It seems that is almost the same with specifying regexp 'library1|library2', so should be easy to implement. Alternative way (no programming requred): give the users explicit regexp hints, like emerge sometimes reporting something like that:
Quote: | * Old versions of installed libraries were detected on your system.
* ... You need to run revdep-rebuild ... as follows:
* # revdep-rebuild --library '(libcrypto|libssl).so.0.9.8' |
* Allow some way of multithreaded search. Maybe it is difficult to implement multithreading inside revdep-rebuild; it still might be possible to allow user to run several revdep-rebuilds concurrently, without interfering in /var/cache/revdep-rebuild/, just with some option to use current dir for temp files instead of the global dir.
* When assigning every file to package, first check if that file is present in any of the packages that are already found from previous files. The chances are high. If yes, no need to search the whole db. |
|
Back to top |
|
|
Kollin Veteran
Joined: 25 Feb 2006 Posts: 1139 Location: Sofia/Bulgaria
|
Posted: Sun Oct 17, 2010 8:03 am Post subject: |
|
|
Well revdep-rebuild is a bash script, I think that the only way to see some speed improvements is some nice guy with good programming skills to port it to C or Python _________________ "Dear Enemy: may the Lord hate you and all your kind, may you be turned orange in hue, and may your head fall off at an awkward moment."
"Linux is like a wigwam - no windows, no gates, apache inside..." |
|
Back to top |
|
|
slis Retired Dev
Joined: 11 Oct 2010 Posts: 67 Location: Limanowa
|
Posted: Sun Oct 17, 2010 11:52 am Post subject: |
|
|
Hi!
Thats interesting, what you say, Kollin.
I wrote small scipt in Python, that collects all binaries and libraries from system, and checks them for broken libraries, and indeed, it's more that twice faster than revdep! And there is just "raw" reading and calling ldd program. Thats impressive.
Time for revdep-rebuild (terminated after checking dynamic linking consistency)
real 1m25.551s
user 1m22.488s
sys 1m31.948s
and time for my little script:
real 0m39.776s
user 0m37.347s
sys 0m39.501s
So, you've right. I'm wondering, why do they wrote revdep-rebuild as bash script, instead of in python? The more, emerge is wrotten in it.
Nevertheless, if someone would be interested, I could finish python version and make it public.
Regards,
Sławek |
|
Back to top |
|
|
dol-sen Retired Dev
Joined: 30 Jun 2002 Posts: 2805 Location: Richmond, BC, Canada
|
Posted: Sun Oct 17, 2010 1:54 pm Post subject: |
|
|
slis Both the current maintainers of revdep-rebuild would like to re-write it in python or c. The portage dev's are also wanting to change portage and add abi_slots to an eapi level which will complete/replace the @preserved-libs feature and make revdep-rebuild obsolete.
join #gentoo-portage on irc, there things can be discussed more. _________________ Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch... |
|
Back to top |
|
|
Kollin Veteran
Joined: 25 Feb 2006 Posts: 1139 Location: Sofia/Bulgaria
|
Posted: Sun Oct 17, 2010 4:07 pm Post subject: |
|
|
dol-sen wrote: | slis Both the current maintainers of revdep-rebuild would like to re-write it in python or c. The portage dev's are also wanting to change portage and add abi_slots to an eapi level which will complete/replace the @preserved-libs feature and make revdep-rebuild obsolete.
join #gentoo-portage on irc, there things can be discussed more. |
Yeah slis do it! _________________ "Dear Enemy: may the Lord hate you and all your kind, may you be turned orange in hue, and may your head fall off at an awkward moment."
"Linux is like a wigwam - no windows, no gates, apache inside..." |
|
Back to top |
|
|
Shining Arcanine Veteran
Joined: 24 Sep 2009 Posts: 1110
|
Posted: Sun Oct 17, 2010 8:37 pm Post subject: |
|
|
Kollin wrote: | Well revdep-rebuild is a bash script, I think that the only way to see some speed improvements is some nice guy with good programming skills to port it to C or Python |
revdep-rebuild is limited by random I/O speeds. On systems with NAND Flash SSDs, revdep-rebuild runs rather quickly. Rewriting it into C will not necessarily make it run faster. Rewriting it to use a faster algorithm (preferably in C) would, although I imagine that if a faster algorithm was readily available, it would be integrated into portage, such that revdep-rebuild would be obsolete. |
|
Back to top |
|
|
user11 Tux's lil' helper
Joined: 25 Nov 2005 Posts: 149
|
Posted: Sun Oct 17, 2010 8:56 pm Post subject: |
|
|
I think that gentoo team will rewrite revdep-rebuild completely at the time that matches their plans. Otherwise, we (non-team) have a risk to create a program that will become unsupported and useless after a month or so (just think of complexities like revdep-rebuild control files...).
Beyond those plans, I suggest making changes to existing script that are likely to be painlessly accepted by present revdep-rebuild maintainers. Little efforts (and little maintenance headache) for the sake of moderate results.
As for the first glance at the sources wrt my simple ideas:
(1) multiple --library options: At least, we could just remind the user that regexps are allowed. No sources modification needed then. Anyway, my very rough patch against app-portage/gentoolkit-0.2.4.6.1-r1 is here: http://pastebin.com/LPuYH3a5
(2) multithreading: revdep-rebuild allows parallel invocations if run non-root. Some coding is needed to allow the user specify such behavior for root as well. Finally, having (1) resolved, no (2) is so needed.
(3) assiging files to packages: There is massive 'grep' invocation, which is known for being VERY (really very) slow for UTF-8 locale. Assigning-files-to-packages phase speeds up much just by running 'LANG=C revdep-rebuild'. I don't know if it is safe to introduce LANG=C into revdep-rebuild itself, if not, it would anyway be worth notifying the user that LANG=C is recommended. |
|
Back to top |
|
|
user11 Tux's lil' helper
Joined: 25 Nov 2005 Posts: 149
|
Posted: Sun Oct 17, 2010 10:33 pm Post subject: |
|
|
Shining Arcanine wrote: | revdep-rebuild is limited by random I/O speeds. |
It is ok to wait for 2 minutes per one system update.
The killing problem is when you have to run revdep-rebuld many times (say, you have many updates or something is broken). Under such conditions almost all of the data needed goes to cache.
Also, on my system (I use HDD and reiserfs for /) I/O does not seem to take more than 50% of real time:
tux ~ # sync; echo 3 > /proc/sys/vm/drop_caches
tux ~ # time revdep-rebuild -ip # real I/O
[...]
* Dynamic linking on your system is consistent... All done.
real 2m48.923s
user 0m42.845s
sys 0m45.058s
tux ~ # time revdep-rebuild -ip # cached I/O
[...]
* Dynamic linking on your system is consistent... All done.
real 1m33.007s
user 0m42.422s
sys 0m45.721s
tux ~ #
|
|
Back to top |
|
|
user11 Tux's lil' helper
Joined: 25 Nov 2005 Posts: 149
|
Posted: Sun Oct 17, 2010 10:45 pm Post subject: |
|
|
Sławek, could you explain why you have could real<user+sys? Does it mean you have multithreaded version of revdep-rebuild? I wish I had timing like that
slis wrote: | Time for revdep-rebuild (terminated after checking dynamic linking consistency)
real 1m25.551s
user 1m22.488s
sys 1m31.948s
|
|
|
Back to top |
|
|
Shining Arcanine Veteran
Joined: 24 Sep 2009 Posts: 1110
|
Posted: Mon Oct 18, 2010 12:43 am Post subject: |
|
|
user11 wrote: | Shining Arcanine wrote: | revdep-rebuild is limited by random I/O speeds. |
It is ok to wait for 2 minutes per one system update.
The killing problem is when you have to run revdep-rebuld many times (say, you have many updates or something is broken). Under such conditions almost all of the data needed goes to cache.
Also, on my system (I use HDD and reiserfs for /) I/O does not seem to take more than 50% of real time:
tux ~ # sync; echo 3 > /proc/sys/vm/drop_caches
tux ~ # time revdep-rebuild -ip # real I/O
[...]
* Dynamic linking on your system is consistent... All done.
real 2m48.923s
user 0m42.845s
sys 0m45.058s
tux ~ # time revdep-rebuild -ip # cached I/O
[...]
* Dynamic linking on your system is consistent... All done.
real 1m33.007s
user 0m42.422s
sys 0m45.721s
tux ~ #
|
I use revdep-rebuild -- --jobs --keep-going and that really is not much of a problem for me.
Here is the time it takes for it to run on my system. I have an Intel 80GB X25-M G2 SSD:
Quote: | # time revdep-rebuild
* Configuring search environment for revdep-rebuild
* Checking reverse dependencies
* Packages containing binaries and libraries broken by a package update
* will be emerged.
* Collecting system binaries and libraries
* Generated new 1_files.rr
* Collecting complete LD_LIBRARY_PATH
* Generated new 2_ldpath.rr
* Checking dynamic linking consistency
[ 100% ]
* Dynamic linking on your system is consistent... All done.
real 1m10.036s
user 0m18.290s
sys 0m28.714s |
|
|
Back to top |
|
|
slis Retired Dev
Joined: 11 Oct 2010 Posts: 67 Location: Limanowa
|
Posted: Mon Oct 18, 2010 7:31 pm Post subject: |
|
|
Hello!
All of you got some rights. The most important factor is hard disc. But, it can be used more or less efficient.
First step is to find all libraries, and this is, what we cannot do faster. But there is disc cache created for.
One tools are good, but other are better. As someone told before, ldd is slower than scanelf. And revdep uses ldd.
Another thing is that, revdep is shell script, so there is no optimizations, and there are just program calls. As we know, to run any program, we need some overhead.
@user11 timings are small for two reason: it's fresh installation (under one month), and I'd interrupted it just after it checks consistency
And one more thing, it's ok to wait two or even five minutes for revdep, but it's not so rare that you have to call it several times. And there we've got headache.
I've done some work and I've prepared script that checks my system for broken libraries, list them and selects packages. In other words, there is something like revdep, but in his very, very alpha It does nothing more for now.
Here are some timings:
Code: |
echo 3 > /proc/sys/vm/drop_caches ; time revdep-rebuild -p
real 2m45.528s
user 0m40.554s
sys 0m29.680s
|
any my script:
Code: |
echo 3 > /proc/sys/vm/drop_caches ; time ./revdep-rebuild.py
real 0m48.806s
user 0m7.779s
sys 0m2.029s
|
Next test was to call three times each program, without clearing cache. Presented are the lowest results:
Code: |
time revdep-rebuild -p
real 1m32.357s
user 0m38.756s
sys 0m28.519s
|
Code: |
time ./revdep-rebuild.py
real 0m7.805s
user 0m6.976s
sys 0m0.976s
|
Please note that I sent only two afternoons on this, and this is second project I'm working on in Python.
If you enjoy and say that is worth of, I'll do some more improvements (I think that I can go down for about 4-5 seconds, or even maybe less)
And one other thing, it's tested on my new notebook, where gentoo is quite fresh (about one month old). I'll test this script on my workstation, or maybe on one of servers with over two years old gentoo.
Regards,
Sławek |
|
Back to top |
|
|
user11 Tux's lil' helper
Joined: 25 Nov 2005 Posts: 149
|
Posted: Mon Oct 18, 2010 10:36 pm Post subject: |
|
|
Sławek,
my opinion is that your script's performance is fine.
Is it a full replacement for revdep-rebuild? |
|
Back to top |
|
|
slis Retired Dev
Joined: 11 Oct 2010 Posts: 67 Location: Limanowa
|
Posted: Tue Oct 19, 2010 4:15 am Post subject: |
|
|
No, it's not.
For now it's only for testing purposes. As I said before, it collects all binaries and libraries from system, checks for broken libraries and matches packages for those. It does nothing more than that.
I have to add some improvements and compatibility (especially command line parameters). Finally, your requests have to be written, such as multiple libraries to check.
When I made some more tests, I'll do my script public, so some volonteers may test it.
Regards
/edit
As i promised yesterday, there are timings from another (older gentoo installation) machine:
AMD Phenom(tm) II X4 965 Processor, 8GB RAM, 4xSATA (RAID-0):
Code: |
sync; echo 3 > /proc/sys/vm/drop_caches ; time revdep-rebuild -p
real 5m13.207s
user 0m34.098s
sys 0m27.935s
sync; echo 3 > /proc/sys/vm/drop_caches ; time ./revdep-rebuild.py
real 3m12.241s
user 0m9.028s
sys 0m2.243s
|
without clearing cache:
Code: |
time revdep-rebuild -p
real 1m28.350s
user 0m34.519s
sys 0m28.917s
time ./revdep-rebuild.py
real 0m9.392s
user 0m8.376s
sys 0m1.060s
|
|
|
Back to top |
|
|
user11 Tux's lil' helper
Joined: 25 Nov 2005 Posts: 149
|
Posted: Tue Oct 19, 2010 6:30 pm Post subject: |
|
|
Sławek,
Sorry for my english in previous question.
I just want to ask, *will* your script become a full replacement to revdep-rebuild?
If yes, I will wait for that. If no, I will probably refine my patch for revdep-rebuild. |
|
Back to top |
|
|
slis Retired Dev
Joined: 11 Oct 2010 Posts: 67 Location: Limanowa
|
Posted: Tue Oct 19, 2010 7:15 pm Post subject: |
|
|
It depends, what do you mean as full replacement. As for now, it won't work excactly the same way as original revdep, so: it does not create any of reveps' files, and output is little different.
But the core is the same: it finds out any broken libraries and give you packages.
If you want, priv me and leave your e-mail, so I'll send you my working wersion so you could check if it fullfits your demands.
Regards,
Sławek |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Wed Oct 20, 2010 10:59 am Post subject: |
|
|
There already is a faster replacement - it's in paludis:
Code: | # time revdep-rebuild -p
* Configuring search environment for revdep-rebuild
* Checking reverse dependencies
* Packages containing binaries and libraries broken by a package update
* will be emerged.
* Collecting system binaries and libraries
* Generated new 1_files.rr
* Collecting complete LD_LIBRARY_PATH
* Generated new 2_ldpath.rr
* Checking dynamic linking consistency
[ 100% ]
* Dynamic linking on your system is consistent... All done.
real 1m31.106s
user 0m49.570s
sys 0m1.200s
# time cave fix-linkage
Searching: 11 directories, 17456 files
No broken packages found
real 0m16.237s
user 0m7.730s
sys 0m1.210s |
(done on a single-core Atom 230, fastest time of two consecutive runs each)
Edit: corresponding times after drop_caches:
Code: | # time revdep-rebuild -p
real 2m1.371s
user 0m50.010s
sys 0m1.060s
# time cave fix-linkage
real 0m44.594s
user 0m10.320s
sys 0m0.490s |
|
|
Back to top |
|
|
sera Retired Dev
Joined: 29 Feb 2008 Posts: 1017 Location: CET
|
Posted: Wed Oct 20, 2010 11:22 am Post subject: |
|
|
And takes multiple --library arguments as in
Code: | cave fix-linkage --library libssl.so.0.9.8 --library libcrypto.so.0.9.8 |
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|