Difference between revisions of "Readahead-fedora"

From ArchWiki
Jump to: navigation, search
m (Usage: Added how to do the initial creation of the lists)
m (Usage)
Line 27: Line 27:
 
== Usage ==
 
== Usage ==
 
To automatically start readahead and update the list, create /etc/rc.d/functions.d/readahead and add this to the file:
 
To automatically start readahead and update the list, create /etc/rc.d/functions.d/readahead and add this to the file:
 +
 +
#
 +
# File for starting readahead and readahead-collector
 +
#
 +
 +
. /etc/readahead.conf
 +
 
  readahead-early() {
 
  readahead-early() {
 
   if [ -e /.readahead ]; then
 
   if [ -e /.readahead ]; then
Line 55: Line 62:
 
  add_hook multi_start readahead-later
 
  add_hook multi_start readahead-later
 
<sub>{{Note|''I wish to avoid editing /etc/rc.sysinit, /etc/rc.multi and /etc/inittab as much as possible. You could do it that way too, if you want to).''}}</sub>
 
<sub>{{Note|''I wish to avoid editing /etc/rc.sysinit, /etc/rc.multi and /etc/inittab as much as possible. You could do it that way too, if you want to).''}}</sub>
 
+
{{Note|If this breaks console-kit in KDE, you might need to use sysinit_end instead of multi_start}}
  
 
Now all you have to do is
 
Now all you have to do is

Revision as of 21:47, 4 October 2010

Readahead-fedora is originally developed by fedora, and contrary to ureadahead it doesn't require patching the kernel. It creates a list of files to put in the page cache before they're needed, thus reducing boot time.

Advantages

  • It doesn't require patching the kernel.
  • It can take multiple lists of files to be preloaded, and sort them according to their position on the disk.
  • It preloads the inode tables on ext2-based file systems.
  • It opens the files without making the system update their access time, therefore avoiding extra disk writes. (Though, this shouldn't matter when using relatime or noatime I think)
  • It uses a lightweight monitoring daemon.

(List shamelessly stolen from the debian package description, original here)

Installation

Ying has created a PKGBUILD for this project, it can be found here.

Note: libprelude currently doesn't build with libtool-2.4. Either downgrade to 2.2.10-3 or wait for a workaround.

Configuration

All configuration is done through /etc/readahead.conf. Some interesting variables might be:

RAC_MAXTIME="100"

A value in seconds that determine how long the collector should run.

RAC_INITPATH="/sbin/init"

A path to your init program. Change this if you use anything other than sysvinit.

RAC_EXECIGN="/sbin/readahead /usr/sbin/preload"

If you want the collector to ignore syscalls from certain programs, this is where you set their paths.

RAC_EXCLUDE="/proc /sys /dev /var/log /var/run /var/lock /home /tmp /var/tmp /media /selinux /mnt"

Directories to ignore while collecting. Anything that isn't needed during boot should probably be here to keep the list slimmed down.

Usage

To automatically start readahead and update the list, create /etc/rc.d/functions.d/readahead and add this to the file:

#
# File for starting readahead and readahead-collector
#

. /etc/readahead.conf

readahead-early() {
  if [ -e /.readahead ]; then
    stat_busy "Starting readahead-collector - collecting data"
      /sbin/readahead-collector
    stat_done
  else
    stat_busy "Starting readahead - early read"
      /sbin/readahead  /etc/readahead.d/*.early
    stat_done
  fi
}

readahead-later() {
  if [ -e /.readahead ]; then
      sleep 8
      touch /.switch-collector-to-later
      rm /.readahead
  else
    stat_busy "Starting readahead - later read"
      sleep 1.6
      /sbin/readahead  /etc/readahead.d/*.later
    stat_done
  fi
}

add_hook sysinit_start readahead-early
add_hook multi_start readahead-later
Note: I wish to avoid editing /etc/rc.sysinit, /etc/rc.multi and /etc/inittab as much as possible. You could do it that way too, if you want to).
Note: If this breaks console-kit in KDE, you might need to use sysinit_end instead of multi_start

Now all you have to do is

touch /.readahead

to let readahead-collector profile your system next boot.

If you wish to manually create a list with readahead-fedora, you just need to temporarily add

init=/sbin/readahead-collector

to the kernel line in your bootloader. You should also disable auditd, because auditd deletes all audit rules during boot, which is contraproductive for the collector. Now, you just need to reboot and let the collector profile your system.

Automated profiling

This is actually really easy. With the above function, just add a cron job that creates the file /.readahead every month or so.

Links