from small one page howto to huge articles all in one place

search text in:




Other .linuxhowtos.org sites: www.linuxhowtos.org
toolsntoys.linuxhowtos.org



Last additions:
How to make X listen on port 6000

How to make X listen on port 6000

words:

34

views:

82617

userrating:

average rating: 1.2 (52 votes) (1=very good 6=terrible)


May, 25th 2007:
April, 26th 2007:
Apr, 10th. 2007:
Druckversion . pdf icon
You are here: Misc

Speeding up the boot process (next generation)

The idea is to preload the useful files into kernel buffer cache before they are needed. Since I/O can happen parallel to the other CPU intensive tasks during bootup, this leads to faster bootup and faster startup time for your chosen applications. Other projects use static lists to preload the files.

This tutorial uses an automated process of generating the "useful" prefetch database.

This is /etc/init.d/my-readahead.
Code:

#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
        before syslog-ng
}

start() {
        ebegin "Starting readahead ROYALE"
        cat /etc/conf.d/* > /dev/null 2>&1 &
        cat /usr/lib/gconv/gconv-modules.cache > /dev/null 2>&1 &
        cat /usr/share/icons/gnome/icon-theme.cache > /dev/null 2>&1 &
        cat /usr/share/icons/hicolor/icon-theme.cache > /dev/null 2>&1 &
        cat `cat /etc/conf.d/sofile-list.load` > /dev/null 2>&1 &
        if [ -f /forcesampler ];then
                /usr/sbin/sample-init-process /etc/conf.d/sofile-list.load &
                rm -f /forcesampler
        fi 
        eend 0
}

stop() {
        eend 0
}

The executable shell script /usr/sbin/sample-init-process:
Code:

 #!/bin/bash
final_db="$1"

# total number of lists to keep in /etc/conf.d/
total_to_keep=4

# total number of samples to make in /forcesampler boot.
# It will take twice this amount of seconds to finish sampling.
total_samples_per_boot=200

# touch empty file if not there
[ ! -f "$final_db" ] && touch "$final_db"

let i=0
while [ "$i" -ne "$total_to_keep" ] ; do
        if [ ! -f "$final_db$i" ] ; then
                break;
        else
                j=$((i+1))
                if [ "$j" = "$total_to_keep" ] ;then
                        j=0
                fi
                if [ -f "$final_db$j" -a "$final_db$i" -nt "$final_db$j" ];then
                        i=$((j))
                        break;
                fi
        fi
        i=$((i+1))
done
if [ "$i" = "$total_to_keep" ] ;then
        i=0
fi

slot="$i"
cp "$final_db" "$final_db$i"

function collect_sample()
{
        lsof | awk '{if ($5=="REG") {if (match($9,".so") || match($9,".conf") \
        || match($9,"/bin/") || match($9,"ttf") || match($9,"libexec")) \
        print $9}}' | sort | uniq >> $1
}

collect_sample /tmp/init_sample1

i=0 
while [ "$i" -ne "$total_samples_per_boot" ] ; do
        collect_sample /tmp/init_sample2
        cat /tmp/init_sample1 /tmp/init_sample2 | sort | uniq > /tmp/init_sample3
        mv /tmp/init_sample3 /tmp/init_sample1
        sleep 1
        i=$((i+1))
done

cat /tmp/init_sample1 "$final_db$slot" | sort | uniq > "$final_db"

rm -f /tmp/init_sample[123]
And then do this:
Code:
chmod +x /usr/sbin/sample-init-process
rc-update add my-readahead default
touch /forcesampler

What you have done is asked my-readahead to create a sampler process which samples what files (fonts, binaries, libraries, configs) are in use, every second. It collects 200 samples (will be busy for at least 10 minutes after boot) and keeps updating the database with a list of useful files.

Once you boot after this the first time, you will probably see a slow down because its collecting samples for use on the next and subsequent boots. Use your system as you normally would. Open firefox, gaim, OO or whatever. Once the sampler script has finished ('ps -aef|grep sample-init-process' will tell you if its running), reboot. Now this and all subsequent boots will be much faster.

If it takes too long for the sample-init-process to finish, reduce the total_samples_per_boot variable in the sampler script to 100 and try again by touching /forcesampler.

In future, whenever you feel like updating the prefetch database, just 'touch /forcesampler' and database will be updated on next reboot.

based on http://forums.gentoo.org/viewtopic-t-478491.html, some script modifications done.

back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2025-12-27
execline - 2.9.8.0
Ebuild name:

dev-lang/execline-2.9.8.0

Description

A non-interactive scripting language

Added to portage

2025-12-27

gloo - 2025.12.02
Ebuild name:

sci-ml/gloo-2025.12.02

Description

library of floating-point neural network inference operators

Added to portage

2025-12-27

libslirp - 4.9.1
Ebuild name:

net-libs/libslirp-4.9.1

Description

A TCP-IP emulator used to provide virtual networking services

Added to portage

2025-12-27

minitest - 6.0.1
Ebuild name:

dev-ruby/minitest-6.0.1

Description

minitest/unit is a small and fast replacement for ruby's huge and slow test

Added to portage

2025-12-27

ostree - 2025.7
Ebuild name:

dev-util/ostree-2025.7

Description

Operating system and container binary deployment and upgrades

Added to portage

2025-12-27

rake-compiler-dock - 1.11.0
Ebuild name:

dev-ruby/rake-compiler-dock-1.11.0

Description

Easy to use and reliable cross compiler environment for building

Added to portage

2025-12-27

rdoc - 7.0.3
Ebuild name:

dev-ruby/rdoc-7.0.3

Description

An extended version of the RDoc library from Ruby 1.8

Added to portage

2025-12-27

rmagick - 6.1.5
Ebuild name:

dev-ruby/rmagick-6.1.5

Description

An interface between Ruby and the ImageMagick(TM) image processing library

Added to portage

2025-12-27

s6 - 2.14.0.0
Ebuild name:

sys-apps/s6-2.14.0.0

Description

skarnet.org's small and secure supervision software suite

Added to portage

2025-12-27

s6-linux-init - 1.2.0.0
Ebuild name:

sys-apps/s6-linux-init-1.2.0.0

Description

Generates an init binary for s6-based init systems

Added to portage

2025-12-27

s6-linux-utils - 2.6.4.0
Ebuild name:

sys-apps/s6-linux-utils-2.6.4.0

Description

Set of tiny linux utilities

Added to portage

2025-12-27

s6-portable-utils - 2.3.1.1
Ebuild name:

sys-apps/s6-portable-utils-2.3.1.1

Description

Set of tiny portable unix utilities

Added to portage

2025-12-27

skalibs - 2.14.5.0
Ebuild name:

dev-libs/skalibs-2.14.5.0

Description

General-purpose libraries from skarnet.org

Added to portage

2025-12-27

slirp4netns - 1.3.3
Ebuild name:

app-containers/slirp4netns-1.3.3

Description

User-mode networking for unprivileged network namespaces

Added to portage

2025-12-27

zstd-ruby - 2.0.4
Ebuild name:

dev-ruby/zstd-ruby-2.0.4

Description

Ruby binding for zstd (Zstandard - Fast real-time compression algorithm).

Added to portage

2025-12-27

2025-12-26
android-studio - 2025.2.2.8
Ebuild name:

dev-util/android-studio-2025.2.2.8

Description

Android development environment based on IntelliJ IDEA

Added to portage

2025-12-26

cargo-c - 0.10.19
Ebuild name:

dev-util/cargo-c-0.10.19

Description

Helper program to build and install c-like libraries

Added to portage

2025-12-26

charliecloud - 0.43
Ebuild name:

sys-cluster/charliecloud-0.43

Description

Lightweight user-defined software stacks for high-performance computi

Added to portage

2025-12-26

cmd2 - 3.1.0
Ebuild name:

dev-python/cmd2-3.1.0

Description

Extra features for standard library's cmd module

Added to portage

2025-12-26

containerd - 2.2.0
Ebuild name:

app-containers/containerd-2.2.0

Description

A daemon to control runC

Added to portage

2025-12-26

docker - 29.1.3
Ebuild name:

app-containers/docker-29.1.3

Description

The core functions you need to create Docker images and run Docker con

Added to portage

2025-12-26

docker-cli - 29.1.3
Ebuild name:

app-containers/docker-cli-29.1.3

Description

the command line binary for docker

Added to portage

2025-12-26

doxygen - 1.15.0-r2
Ebuild name:

app-text/doxygen-1.15.0-r2

Description

Documentation system for most programming languages

Added to portage

2025-12-26

eselect-ruby - 20251225
Ebuild name:

app-eselect/eselect-ruby-20251225

Description

Manages multiple Ruby versions

Added to portage

2025-12-26

gnatformat - 25.0.0-r2
Ebuild name:

dev-ada/gnatformat-25.0.0-r2

Description

Opinionated code formatter for the Ada language

Added to portage

2025-12-26

gpr - 26.0.0
Ebuild name:

dev-ada/gpr-26.0.0

Description

LibGPR2 - Parser for GPR Project files

Added to portage

2025-12-26

granite - 7.7.0
Ebuild name:

dev-libs/granite-7.7.0

Description

Elementary OS library that extends GTK+

Added to portage

2025-12-26

intellij-idea - 2025.3.1
Ebuild name:

dev-util/intellij-idea-2025.3.1

Description

A complete toolset for web, mobile and enterprise development

Added to portage

2025-12-26

langkit - 26.0.0
Ebuild name:

dev-ada/langkit-26.0.0

Description

A Python framework to generate language parsers

Added to portage

2025-12-26

libnpupnp - 6.2.3
Ebuild name:

net-libs/libnpupnp-6.2.3

Description

A C++ base UPnP library, derived from Portable UPnP, a.k.a libupnp

Added to portage

2025-12-26

librt - 0.7.5
Ebuild name:

dev-python/librt-0.7.5

Description

Mypyc runtime library

Added to portage

2025-12-26

multi_json - 1.19.0
Ebuild name:

dev-ruby/multi_json-1.19.0

Description

A gem to provide swappable JSON backends

Added to portage

2025-12-26

oneDNN - 3.10.2
Ebuild name:

sci-ml/oneDNN-3.10.2

Description

oneAPI Deep Neural Network Library

Added to portage

2025-12-26

openhab - 1
Ebuild name:

acct-user/openhab-1

Description

Added to portage

2025-12-26

openhab-bin - 5.1.0
Ebuild name:

app-misc/openhab-bin-5.1.0

Description

An open-source automation software for your home

Added to portage

2025-12-26

org-static-blog - 9999
Ebuild name:

app-emacs/org-static-blog-9999

Description

Static site generator using Emacs's org-mode

Added to portage

2025-12-26

org-superstar-mode - 1.5.0
Ebuild name:

app-emacs/org-superstar-mode-1.5.0

Description

Prettify headings and plain lists in Org mode (use UTF8 bullets)

Added to portage

2025-12-26

osm - 1.10
Ebuild name:

app-emacs/osm-1.10

Description

OpenStreetMap tile-based viewer for GNU Emacs

Added to portage

2025-12-26

osm - 1.9
Ebuild name:

app-emacs/osm-1.9

Description

OpenStreetMap tile-based viewer for GNU Emacs

Added to portage

2025-12-26

portage - 3.0.69.3-r3
Ebuild name:

sys-apps/portage-3.0.69.3-r3

Description

The package management and distribution system for Gentoo

Added to portage

2025-12-26

primecount - 8.0
Ebuild name:

sci-mathematics/primecount-8.0

Description

Highly optimized CLI and library to count primes

Added to portage

2025-12-26

primecountpy - 0.1.1-r1
Ebuild name:

dev-python/primecountpy-0.1.1-r1

Description

Cython interface to sci-mathematics/primecount

Added to portage

2025-12-26

q4wine - 1.4.2
Ebuild name:

app-emulation/q4wine-1.4.2

Description

Qt GUI configuration tool for Wine

Added to portage

2025-12-26

qemu - 10.1.3-r1
Ebuild name:

app-emulation/qemu-10.1.3-r1

Description

QEMU + Kernel-based Virtual Machine userland tools

Added to portage

2025-12-26

rbs - 3.10.0
Ebuild name:

dev-ruby/rbs-3.10.0

Description

The language for type signatures for Ruby and standard library definitions

Added to portage

2025-12-26

runc - 1.4.0
Ebuild name:

app-containers/runc-1.4.0

Description

runc container cli tools

Added to portage

2025-12-26

typer - 0.21.0
Ebuild name:

dev-python/typer-0.21.0

Description

Build great CLIs. Easy to code. Based on Python type hints

Added to portage

2025-12-26

upmpdcli - 1.9.8
Ebuild name:

media-sound/upmpdcli-1.9.8

Description

UPnP Media Renderer front-end for MPD, the Music Player Daemon

Added to portage

2025-12-26

vdr-femon - 2.4.0_p20240910-r2
Ebuild name:

media-plugins/vdr-femon-2.4.0_p20240910-r2

Description

VDR Plugin DVB Frontend Status Monitor (signal strength/

Added to portage

2025-12-26

vdr-wirbelscan - 2024.09.15-r1
Ebuild name:

media-plugins/vdr-wirbelscan-2024.09.15-r1

Description

VDR Plugin Scan for channels on DVB-? and on PVR*-Cards

Added to portage

2025-12-26

worldofpadman - 1.7.0-r3
Ebuild name:

games-fps/worldofpadman-1.7.0-r3

Description

Cartoon style multiplayer first-person shooter

Added to portage

2025-12-26

rdf newsfeed | rss newsfeed | Atom newsfeed
Copyright 2004-2025 Sascha Nitsch Unternehmensberatung GmbH
- Copyright and legal notices -
Time to create this page: 75.9 ms