1
sreadahead - a readahead implementation optimized for solid state devices
11
Seek times are nearly zero on SSD devices. However, it still takes
12
significant time to actually to the IO and get all the data needed
13
to boot the system into memory. Since at boot we can't do anything
14
else but wait on this IO, we lose a lot of time.
16
Sreadahead attempts to eliminate all this IO wait time at boot by
17
reading all the needed pages from disk and into memory before they
18
are actually needed by the boot process.
20
During an initial boot process, we monitor which parts of the disk
21
contents are actually used. At a later boot, we can then read all
22
that information at the first start of the boot process.
27
The initial boot is when we don't know which content is needed during
28
the boot phase. During this boot process, we cannot accelerate the
29
boot process, but we can monitor the boot process and determine which
30
content is read from disk, and create a list of this content to use
33
Sreadahead implements this phase by starting a kernel tracer which
34
monitors open() syscalls in the kernel and storing them in the debugfs
35
trace buffer. After the system is done booting, sreadahead processes
36
the trace content and writes out a pack file that will be read during
42
If sreadahead finds a pack file on the system at boot time, it will
43
open this pack file and start fetching all the needed files listed
44
in this pack into memory. Sreadahead minimizes the reads to data that
45
is actually needed, and will not read entire files if strictly needed.
47
Resetting the pack file
48
-----------------------
50
At one point in time, the pack file will reflect an out-of-date system
51
state that is no longer accurate. This will degrade the effectiveness
52
of sreadahead, and at such a point in time, the pack file should be
53
deleted, so that a new pack can be automatically generated.
58
How distributions should implement sreadahead.
60
Distributions packaging sreadahead should implement three components:
62
1) starting sreadahead as early as possible;
63
2) (optional) at the end of the boot sequence, signal sreadahead to
64
generate it's pack file;
65
3) once in a while, remove the pack file so it can be refreshed.
67
Typically, the following line would be added to the top of
68
the "rc.sysvinit" script, or equivalent, such as "rcS" or "single" init.d
73
This will make sreadahead fork into the background and load an existing
74
readahead.packed file, and then doing it's work.
76
Sreadahead will generate the pack file after 15 seconds automatically.
77
If this is too late, one can send sreadahead a SIGUSR1 signal at
78
any time before this 15 seconds, to make sreadahead immediately stop
79
tracing and create a pack file.
81
To update the pack file, one can simply remove /etc/readahead.packed and