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:

82143

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.


rate this article:
current rating: average rating: 1.3 (31 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back



Support us on Content Nation

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2025-11-24
algol68g - 3.10.7
Ebuild name:

dev-lang/algol68g-3.10.7

Description

Algol 68 Genie compiler-interpreter

Added to portage

2025-11-24

bandit - 1.9.2
Ebuild name:

dev-python/bandit-1.9.2

Description

A security linter from OpenStack Security

Added to portage

2025-11-24

bash - 5.4_alpha_pre20251119
Ebuild name:

app-shells/bash-5.4_alpha_pre20251119

Description

The standard GNU Bourne again shell

Added to portage

2025-11-24

cantera - 3.2.0
Ebuild name:

sci-libs/cantera-3.2.0

Description

Object-oriented tool suite for chemical kinetics, thermodynamics, and transp

Added to portage

2025-11-24

commandergenius - 3.6.1
Ebuild name:

games-arcade/commandergenius-3.6.1

Description

Open Source Commander Keen clone (needs original game files)

Added to portage

2025-11-24

discord - 0.0.115-r1
Ebuild name:

net-im/discord-0.0.115-r1

Description

All-in-one voice and text chat for gamers

Added to portage

2025-11-24

elogind - 255.22
Ebuild name:

sys-auth/elogind-255.22

Description

The systemd project's logind, extracted to a standalone package

Added to portage

2025-11-24

enscript - 1.6.6-r2
Ebuild name:

app-text/enscript-1.6.6-r2

Description

Powerful text-to-postscript converter

Added to portage

2025-11-24

gcc - 16.0.0_p20251123
Ebuild name:

sys-devel/gcc-16.0.0_p20251123

Description

The GNU Compiler Collection

Added to portage

2025-11-24

git-sources - 6.18_rc7
Ebuild name:

sys-kernel/git-sources-6.18_rc7

Description

The very latest -git version of the Linux kernel

Added to portage

2025-11-24

gtk - 4.20.3
Ebuild name:

gui-libs/gtk-4.20.3

Description

GTK is a multi-platform toolkit for creating graphical user interfaces

Added to portage

2025-11-24

highfive - 2.10.1-r1
Ebuild name:

sci-libs/highfive-2.10.1-r1

Description

Header-only C++ interface for libhdf5

Added to portage

2025-11-24

highfive - 2.8.0-r1
Ebuild name:

sci-libs/highfive-2.8.0-r1

Description

Header-only C++ interface for libhdf5

Added to portage

2025-11-24

highfive - 3.2.0
Ebuild name:

sci-libs/highfive-3.2.0

Description

Header-only C++ interface for libhdf5

Added to portage

2025-11-24

mesa-amber - 21.3.9-r3
Ebuild name:

media-libs/mesa-amber-21.3.9-r3

Description

OpenGL-like graphic library for Linux

Added to portage

2025-11-24

mkdocs-gen-files - 0.6.0
Ebuild name:

dev-python/mkdocs-gen-files-0.6.0

Description

MkDocs plugin to programmatically generate documentation pages du

Added to portage

2025-11-24

mutt - 2.2.16
Ebuild name:

mail-client/mutt-2.2.16

Description

A small but very powerful text-based mail client

Added to portage

2025-11-24

nginx-unit - 1.35.0-r1
Ebuild name:

www-servers/nginx-unit-1.35.0-r1

Description

Dynamic web and application server

Added to portage

2025-11-24

plz - 0.7.2
Ebuild name:

app-emacs/plz-0.7.2

Description

HTTP library with curl backend for GNU Emacs

Added to portage

2025-11-24

postfix - 3.11_pre20251122
Ebuild name:

mail-mta/postfix-3.11_pre20251122

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2025-11-24

pqiv - 2.13.3
Ebuild name:

media-gfx/pqiv-2.13.3

Description

A powerful GTK 3 based command-line image viewer with a minimal UI

Added to portage

2025-11-24

pv - 1.10.2
Ebuild name:

sys-apps/pv-1.10.2

Description

Pipe Viewer a tool for monitoring the progress of data through a pipe

Added to portage

2025-11-24

pylast - 7.0.0
Ebuild name:

dev-python/pylast-7.0.0

Description

Python interface to last.fm and other api-compatible websites

Added to portage

2025-11-24

pypdf - 6.4.0
Ebuild name:

dev-python/pypdf-6.4.0

Description

Python library to work with PDF files

Added to portage

2025-11-24

pytest-golden - 1.0.0
Ebuild name:

dev-python/pytest-golden-1.0.0

Description

Plugin for pytest that offloads expected outputs to data files

Added to portage

2025-11-24

pytest-reserial - 0.5.1
Ebuild name:

dev-python/pytest-reserial-0.5.1

Description

Pytest plugin for recording and replaying serial port traffic duri

Added to portage

2025-11-24

racket - 9.0
Ebuild name:

dev-scheme/racket-9.0

Description

General purpose, multi-paradigm Lisp-Scheme programming language

Added to portage

2025-11-24

rclone - 1.72.0
Ebuild name:

net-misc/rclone-1.72.0

Description

A program to sync files to and from various cloud storage providers

Added to portage

2025-11-24

restructuredtext-lint - 2.0.2
Ebuild name:

dev-python/restructuredtext-lint-2.0.2

Description

Checks PyPI validity of reStructuredText

Added to portage

2025-11-24

rpm - 4.20.1-r2
Ebuild name:

app-arch/rpm-4.20.1-r2

Description

The RPM Package Manager

Added to portage

2025-11-24

rpm - 6.0.0-r1
Ebuild name:

app-arch/rpm-6.0.0-r1

Description

The RPM Package Manager

Added to portage

2025-11-24

scream - 4.0-r2
Ebuild name:

media-sound/scream-4.0-r2

Description

Plays sound received from network or from a QEMU Windows VM

Added to portage

2025-11-24

scribus - 1.7.1_pre20251119
Ebuild name:

app-office/scribus-1.7.1_pre20251119

Description

Desktop publishing (DTP) and layout program

Added to portage

2025-11-24

secretstorage - 3.5.0
Ebuild name:

dev-python/secretstorage-3.5.0

Description

Python bindings to FreeDesktop.org Secret Service API

Added to portage

2025-11-24

sourcegit - 2025.38
Ebuild name:

dev-vcs/sourcegit-2025.38

Description

Open Source Git GUI client using .NET AvaloniaUI

Added to portage

2025-11-24

sphinxcontrib-mermaid - 1.2.2
Ebuild name:

dev-python/sphinxcontrib-mermaid-1.2.2

Description

Sphinx spelling extension

Added to portage

2025-11-24

stellarium - 25.3-r1
Ebuild name:

sci-astronomy/stellarium-25.3-r1

Description

3D photo-realistic skies in real time

Added to portage

2025-11-24

sundials - 7.5.0
Ebuild name:

sci-libs/sundials-7.5.0

Description

Suite of nonlinear solvers

Added to portage

2025-11-24

syd - 3.45.1
Ebuild name:

sys-apps/syd-3.45.1

Description

seccomp and landlock based application sandbox with support for namespaces

Added to portage

2025-11-24

thin-provisioning-tools - 1.3.1
Ebuild name:

sys-block/thin-provisioning-tools-1.3.1

Description

A suite of tools for thin provisioning on Linux

Added to portage

2025-11-24

timescaledb - 2.23.1
Ebuild name:

dev-db/timescaledb-2.23.1

Description

Open-source time-series SQL database

Added to portage

2025-11-24

tinycss2 - 1.5.1
Ebuild name:

dev-python/tinycss2-1.5.1

Description

A complete yet simple CSS parser for Python

Added to portage

2025-11-24

wayland-protocols - 1.46
Ebuild name:

dev-libs/wayland-protocols-1.46

Description

Wayland protocol files

Added to portage

2025-11-24

xapian - 1.4.30
Ebuild name:

dev-libs/xapian-1.4.30

Description

Xapian Probabilistic Information Retrieval library

Added to portage

2025-11-24

xapian-bindings - 1.4.30
Ebuild name:

dev-libs/xapian-bindings-1.4.30

Description

SWIG and JNI bindings for Xapian

Added to portage

2025-11-24

xapian-omega - 1.4.30
Ebuild name:

app-text/xapian-omega-1.4.30

Description

An application built on Xapian, consisting of indexers and a CGI searc

Added to portage

2025-11-24

zfs - 2.2.9
Ebuild name:

sys-fs/zfs-2.2.9

Description

Userland utilities for ZFS Linux kernel module

Added to portage

2025-11-24

zfs-kmod - 2.2.9
Ebuild name:

sys-fs/zfs-kmod-2.2.9

Description

Linux ZFS kernel module for sys-fs/zfs

Added to portage

2025-11-24

2025-11-23
breeze - 6.5.3-r1
Ebuild name:

kde-plasma/breeze-6.5.3-r1

Description

Breeze visual style for the Plasma desktop

Added to portage

2025-11-23

cpptrace - 1.0.4
Ebuild name:

dev-cpp/cpptrace-1.0.4

Description

Simple, portable, and self-contained stacktrace library for C++11 and newer

Added to portage

2025-11-23

ffmpeg - 6.1.4
Ebuild name:

media-video/ffmpeg-6.1.4

Description

Complete solution to record/convert/stream audio and video

Added to portage

2025-11-23

ffmpeg-compat - 6.1.4
Ebuild name:

media-video/ffmpeg-compat-6.1.4

Description

Complete solution to record/convert/stream audio and video

Added to portage

2025-11-23

gcc - 13.4.1_p20251120
Ebuild name:

sys-devel/gcc-13.4.1_p20251120

Description

The GNU Compiler Collection

Added to portage

2025-11-23

gcc - 14.3.1_p20251121
Ebuild name:

sys-devel/gcc-14.3.1_p20251121

Description

The GNU Compiler Collection

Added to portage

2025-11-23

gcc - 15.2.1_p20251122
Ebuild name:

sys-devel/gcc-15.2.1_p20251122

Description

The GNU Compiler Collection

Added to portage

2025-11-23

huggingface_hub - 1.1.5
Ebuild name:

sci-ml/huggingface_hub-1.1.5

Description

a client library to interact with the Hugging Face Hub

Added to portage

2025-11-23

odamex - 11.2.0
Ebuild name:

games-engines/odamex-11.2.0

Description

Online multiplayer free software engine for DOOM

Added to portage

2025-11-23

protontricks - 1.13.1
Ebuild name:

app-emulation/protontricks-1.13.1

Description

app-emulation/winetricks wrapper for Proton (Steam Play) games

Added to portage

2025-11-23

qtile - 0.34.0
Ebuild name:

x11-wm/qtile-0.34.0

Description

A full-featured, hackable tiling window manager written in Python

Added to portage

2025-11-23

rq - 2.6.1
Ebuild name:

dev-python/rq-2.6.1

Description

Simple, lightweight library for creating and processing background jobs

Added to portage

2025-11-23

stormlib - 9.31
Ebuild name:

app-arch/stormlib-9.31

Description

Library to read and write MPQ archives (Diablo, StarCraft)

Added to portage

2025-11-23

tg_owt - 0_pre20251117
Ebuild name:

media-libs/tg_owt-0_pre20251117

Description

WebRTC build for Telegram

Added to portage

2025-11-23

tpm-tools - 1.3.9.2-r1
Ebuild name:

app-crypt/tpm-tools-1.3.9.2-r1

Description

TrouSerS' support tools for the Trusted Platform Modules

Added to portage

2025-11-23

tpm2-abrmd - 3.0.0-r2
Ebuild name:

app-crypt/tpm2-abrmd-3.0.0-r2

Description

TPM2 Access Broker & Resource Manager

Added to portage

2025-11-23

tpm2-openssl - 1.3.0
Ebuild name:

app-crypt/tpm2-openssl-1.3.0

Description

OpenSSL Provider for TPM2 integration

Added to portage

2025-11-23

tpm2-pkcs11 - 1.9.1
Ebuild name:

app-crypt/tpm2-pkcs11-1.9.1

Description

A PKCS11 interface for TPM2 hardware

Added to portage

2025-11-23

uri - 4.4.0-r1
Ebuild name:

dev-ml/uri-4.4.0-r1

Description

An RFC3986 URI/URL parsing library

Added to portage

2025-11-23

vivaldi-snapshot - 7.8.3872.3
Ebuild name:

www-client/vivaldi-snapshot-7.8.3872.3

Description

A browser for our friends

Added to portage

2025-11-23

weechat - 4.7.2
Ebuild name:

net-irc/weechat-4.7.2

Description

Portable and multi-interface IRC client

Added to portage

2025-11-23

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2020 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 51.9 ms