Possible to use ureadahead to cache frequently used programs?

EDIT I kinda answered my question with the help of this. The only question remaining is how to make the changes permanently stay in the pack-file and not be lost on reprofile. I'll leave the question open in case someone knows of a way (I'll accept that as an answer then). /EDIT

I use my PC in a very similar fashion after boot: I'm using evince, chromium-browser, gmpc and gpodder most of the time. Now I want to cache those programs (at the expense of boot time if needed) using ureadahead.

Now I looked at the contents of the ureadahead pack like this sudo ureadahead --dump|grep chromium and found only icons, .dekstop files and gconf key to be cached*.

So I was wondering whether there's a way to make ureadahead cache the binaries and libraries of my most commonly used programs as well and make them open in a snap after boot.

*As far as I understood ureadahead doesn't really cache but rather keep a list of files and sorts them by inodes thus optimizing the access pattern but well...


Solution 1:

Maybe

Hmm - maybe the preload is the application what you are looking at

:~$ apt-cache show preload

Description: adaptive readahead daemon
 preload monitors applications that users run, and by analyzing this
 data, predicts what applications users might run, and fetches those
 binaries and their dependencies into memory for faster startup times.
 .
 Note that installing preload will not make your system boot faster
 and that preload is a daemon that runs with root priviledges.

Homepage: http://sourceforge.net/projects/preload

Few Links

http://www.cyberciti.biz/tips/speed-up-your-linux-system.html

http://www.howtoforge.com/speed-up-your-system-with-preload-on-ubuntu-9.04

Solution 2:

I got it working thanks to this, but it's not a perfect solution:

  • Set the pre-stop exec sleep timeout in /etc/init/ureadahead.conf (last line) to something bigger depending on your boot time (I used 80 seconds).
  • Put the programs you want cached in autostart; for me that was totem gedit evince and gpodder. For convenience I added the prefix URA to find them more easily later for disabling (i.e. URA totem, URA gedit etc.).
  • Remove the old packfile sudo rm /var/lib/ureadahead/*.pack and reboot.

Works OK. The problem with this approach is that every time ureadahead gets reprofiled you most probably would have to do this again.