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:

90941

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
2026-12-04
Search-Xapian - 1.2.25.7
Ebuild name:

dev-perl/Search-Xapian-1.2.25.7

Description

Perl XS frontend to the Xapian C++ search library

Added to portage

2026-12-04

cloudflare-warp - 2026.9.3927.0
Ebuild name:

net-vpn/cloudflare-warp-2026.9.3927.0

Description

Cloudflare Warp Client

Added to portage

2026-12-04

containerd - 2.4.3
Ebuild name:

app-containers/containerd-2.4.3

Description

A daemon to control runC

Added to portage

2026-12-04

diffofdiffs - 1.1.0
Ebuild name:

dev-util/diffofdiffs-1.1.0

Description

Compare two patches or Git commits side by side

Added to portage

2026-12-04

gmime - 3.2.16
Ebuild name:

dev-libs/gmime-3.2.16

Description

Library for creating and parsing MIME messages

Added to portage

2026-12-04

kcoreaddons - 6.31.0-r1
Ebuild name:

kde-frameworks/kcoreaddons-6.31.0-r1

Description

Framework for solving common problems such as caching, randomi

Added to portage

2026-12-04

kcoreaddons - 6.32.0-r1
Ebuild name:

kde-frameworks/kcoreaddons-6.32.0-r1

Description

Framework for solving common problems such as caching, randomi

Added to portage

2026-12-04

qbittorrent - 5.3.1
Ebuild name:

net-p2p/qbittorrent-5.3.1

Description

BitTorrent client in C++ and Qt

Added to portage

2026-12-04

simdjson - 5.4.0
Ebuild name:

dev-libs/simdjson-5.4.0

Description

SIMD accelerated C++ JSON library

Added to portage

2026-12-04

slirp4netns - 1.3.8
Ebuild name:

app-containers/slirp4netns-1.3.8

Description

User-mode networking for unprivileged network namespaces

Added to portage

2026-12-04

terraform - 1.17.3
Ebuild name:

app-admin/terraform-1.17.3

Description

A tool for building, changing, and combining infrastructure safely

Added to portage

2026-12-04

ty - 1.1.0
Ebuild name:

dev-util/ty-1.1.0

Description

An extremely fast Python type checker and language server, written in Rust

Added to portage

2026-12-04

udev-hid-bpf - 2.3.0_p20260703
Ebuild name:

sys-kernel/udev-hid-bpf-2.3.0_p20260703

Description

Automatic HID-BPF loader based on udev events for device wo

Added to portage

2026-12-04

vec - 0.5.1.1
Ebuild name:

dev-haskell/vec-0.5.1.1

Description

Vec length-indexed (sized) list

Added to portage

2026-12-04

xapian - 2.2.0
Ebuild name:

dev-libs/xapian-2.2.0

Description

Xapian Probabilistic Information Retrieval library

Added to portage

2026-12-04

xapian-bindings - 2.2.0
Ebuild name:

dev-libs/xapian-bindings-2.2.0

Description

SWIG and JNI bindings for Xapian

Added to portage

2026-12-04

xapian-omega - 2.2.0
Ebuild name:

app-text/xapian-omega-2.2.0

Description

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

Added to portage

2026-12-04

2026-12-03
astroid - 4.4.1
Ebuild name:

dev-python/astroid-4.4.1

Description

Abstract Syntax Tree for logilab packages

Added to portage

2026-12-03

authlib - 1.9.11
Ebuild name:

dev-python/authlib-1.9.11

Description

A Python library in building OAuth and OpenID Connect servers and clients

Added to portage

2026-12-03

aws-c-io - 1.1.3
Ebuild name:

dev-libs/aws-c-io-1.1.3

Description

AWS C IO It handles all IO and TLS work for application protocols

Added to portage

2026-12-03

b2sdk - 2.13.6
Ebuild name:

dev-python/b2sdk-2.13.6

Description

Library to access Backblaze B2 cloud storage

Added to portage

2026-12-03

chipass - 2026.11.1
Ebuild name:

app-admin/chipass-2026.11.1

Description

A slop-free, Qt6 secure password manager

Added to portage

2026-12-03

cmd2 - 4.4.5
Ebuild name:

dev-python/cmd2-4.4.5

Description

Extra features for standard library's cmd module

Added to portage

2026-12-03

django - 5.2.20
Ebuild name:

dev-python/django-5.2.20

Description

High-level Python web framework

Added to portage

2026-12-03

django - 6.0.11
Ebuild name:

dev-python/django-6.0.11

Description

High-level Python web framework

Added to portage

2026-12-03

django - 6.1.4
Ebuild name:

dev-python/django-6.1.4

Description

High-level Python web framework

Added to portage

2026-12-03

escapevelocity - 1.1-r1
Ebuild name:

dev-java/escapevelocity-1.1-r1

Description

A reimplementation of a subset of the Apache Velocity templating sys

Added to portage

2026-12-03

faker - 40.69.0
Ebuild name:

dev-python/faker-40.69.0

Description

A Python package that generates fake data for you

Added to portage

2026-12-03

firefox - 161.0.1
Ebuild name:

www-client/firefox-161.0.1

Description

Firefox Web Browser

Added to portage

2026-12-03

firefox-l10n - 161.0.1
Ebuild name:

www-client/firefox-l10n-161.0.1

Description

Firefox Web Browser's translation files

Added to portage

2026-12-03

google-api-core - 2.45.0
Ebuild name:

dev-python/google-api-core-2.45.0

Description

Core Library for Google Client Libraries

Added to portage

2026-12-03

google-auth - 2.63.2
Ebuild name:

dev-python/google-auth-2.63.2

Description

Google Authentication Library

Added to portage

2026-12-03

graphicsmagick - 1.3.50
Ebuild name:

media-gfx/graphicsmagick-1.3.50

Description

Collection of tools and libraries for many image formats

Added to portage

2026-12-03

guava - 33.4.8
Ebuild name:

dev-java/guava-33.4.8

Description

A collection of Google's core Java libraries

Added to portage

2026-12-03

guava-testlib - 33.4.8
Ebuild name:

dev-java/guava-testlib-33.4.8

Description

A set of java classes to assist the tests for Guava itself

Added to portage

2026-12-03

hcloud - 2.28.0
Ebuild name:

dev-python/hcloud-2.28.0

Description

Official Hetzner Cloud python library

Added to portage

2026-12-03

highline - 7.2.2
Ebuild name:

app-emacs/highline-7.2.2

Description

Minor mode to highlight current line in buffer

Added to portage

2026-12-03

hypothesis - 6.170.27
Ebuild name:

dev-python/hypothesis-6.170.27

Description

A library for property based testing

Added to portage

2026-12-03

jwcrypto - 1.6.3
Ebuild name:

dev-python/jwcrypto-1.6.3

Description

Implements JWK,JWS,JWE specifications using python-cryptography

Added to portage

2026-12-03

kotlin-bin - 2.5.0
Ebuild name:

dev-lang/kotlin-bin-2.5.0

Description

Statically typed language that targets the JVM and JavaScript

Added to portage

2026-12-03

libsdl3 - 3.4.22
Ebuild name:

media-libs/libsdl3-3.4.22

Description

Simple Direct Media Layer

Added to portage

2026-12-03

libslz - 1.4.0
Ebuild name:

dev-libs/libslz-1.4.0

Description

Stateless, zlib-compatible, and very fast compression library

Added to portage

2026-12-03

mastodon - 2.1.9
Ebuild name:

app-emacs/mastodon-2.1.9

Description

Emacs client for Mastodon, federated microblogging social network

Added to portage

2026-12-03

mercurial - 7.2.6
Ebuild name:

dev-vcs/mercurial-7.2.6

Description

Scalable distributed SCM

Added to portage

2026-12-03

obs-studio - 33.0.3
Ebuild name:

media-video/obs-studio-33.0.3

Description

Software for Recording and Streaming Live Video Content

Added to portage

2026-12-03

openssh - 10.6_p2-r1
Ebuild name:

net-misc/openssh-10.6_p2-r1

Description

Port of OpenBSD's free SSH release

Added to portage

2026-12-03

picolisp - 26.9
Ebuild name:

dev-lang/picolisp-26.9

Description

Open source Lisp dialect based on LLVM

Added to portage

2026-12-03

pika - 1.5.1
Ebuild name:

dev-python/pika-1.5.1

Description

Pure-Python implementation of the AMQP

Added to portage

2026-12-03

postfix - 3.12_pre20261201
Ebuild name:

mail-mta/postfix-3.12_pre20261201

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2026-12-03

pyotp - 2.12.3
Ebuild name:

dev-python/pyotp-2.12.3

Description

PyOTP is a Python library for generating and verifying one-time passwords

Added to portage

2026-12-03

pypy - 2.7.8.1.1
Ebuild name:

dev-lang/pypy-2.7.8.1.1

Description

A fast, compliant alternative implementation of the Python () language

Added to portage

2026-12-03

pypy-exe - 8.1.1
Ebuild name:

dev-python/pypy-exe-8.1.1

Description

PyPy executable (build from source)

Added to portage

2026-12-03

pypy-exe-bin - 8.1.1
Ebuild name:

dev-python/pypy-exe-bin-8.1.1

Description

PyPy executable (pre-built version)

Added to portage

2026-12-03

pyside - 6.12.1
Ebuild name:

dev-python/pyside-6.12.1

Description

Python bindings for the Qt framework

Added to portage

2026-12-03

pyspnego - 0.13.0
Ebuild name:

dev-python/pyspnego-0.13.0

Description

Library to handle SPNEGO and CredSSP authentication

Added to portage

2026-12-03

pytest-env - 1.8.8
Ebuild name:

dev-python/pytest-env-1.8.8

Description

pytest plugin that allows you to add environment variables

Added to portage

2026-12-03

python-dateutil - 4.0.0-r1
Ebuild name:

dev-python/python-dateutil-4.0.0-r1

Description

Extensions to the standard Python datetime module

Added to portage

2026-12-03

python-discovery - 1.9.9
Ebuild name:

dev-python/python-discovery-1.9.9

Description

Python interpreter discovery

Added to portage

2026-12-03

python-engineio - 4.15.2
Ebuild name:

dev-python/python-engineio-4.15.2

Description

Python implementation of the Engine.IO realtime server

Added to portage

2026-12-03

pyzotero - 1.17.2
Ebuild name:

dev-python/pyzotero-1.17.2

Description

A Python client for the Zotero API

Added to portage

2026-12-03

qrl-wallet-bin - 1.9.2
Ebuild name:

net-misc/qrl-wallet-bin-1.9.2

Description

Quantum Resistant Ledger desktop wallet

Added to portage

2026-12-03

racket-mode - 1_p20261128
Ebuild name:

app-emacs/racket-mode-1_p20261128

Description

Emacs modes for Racket edit, REPL, check-syntax, debug, profile,

Added to portage

2026-12-03

regex - 2026.12.2
Ebuild name:

dev-python/regex-2026.12.2

Description

Alternative regular expression module to replace re

Added to portage

2026-12-03

scikit-build - 1.0.0
Ebuild name:

dev-python/scikit-build-1.0.0

Description

Improved build system generator for Python C/C++/Fortran/Cython exten

Added to portage

2026-12-03

scx-loader - 1.2.0
Ebuild name:

sys-kernel/scx-loader-1.2.0

Description

DBUS on-demand loader of sched-ext schedulers

Added to portage

2026-12-03

shellcheck-bin - 0.12.0
Ebuild name:

dev-util/shellcheck-bin-0.12.0

Description

Shell script analysis tool (binary package)

Added to portage

2026-12-03

sphinx-autodoc-typehints - 3.17.7
Ebuild name:

dev-python/sphinx-autodoc-typehints-3.17.7

Description

Type hints support for the Sphinx autodoc extension

Added to portage

2026-12-03

sqlglot - 30.37.0
Ebuild name:

dev-python/sqlglot-30.37.0

Description

An easily customizable SQL parser and transpiler

Added to portage

2026-12-03

subrandr - 1.5.0
Ebuild name:

media-libs/subrandr-1.5.0

Description

Subtitle rendering library for rendering non-ASS subtitles

Added to portage

2026-12-03

tor - 0.4.9.18
Ebuild name:

net-vpn/tor-0.4.9.18

Description

Anonymizing overlay network for TCP

Added to portage

2026-12-03

tornado - 6.6.2
Ebuild name:

dev-python/tornado-6.6.2

Description

Python web framework and asynchronous networking library

Added to portage

2026-12-03

xe-guest-utilities - 10.0.1
Ebuild name:

app-emulation/xe-guest-utilities-10.0.1

Description

XenServer / XCP-ng guest agent reporting guest metrics to t

Added to portage

2026-12-03

xen - 4.20.5
Ebuild name:

app-emulation/xen-4.20.5

Description

The Xen virtual machine monitor

Added to portage

2026-12-03

xen - 4.22.1
Ebuild name:

app-emulation/xen-4.22.1

Description

The Xen virtual machine monitor

Added to portage

2026-12-03

xen-tools - 4.20.5
Ebuild name:

app-emulation/xen-tools-4.20.5

Description

Xen tools including QEMU and xl

Added to portage

2026-12-03

xen-tools - 4.22.1
Ebuild name:

app-emulation/xen-tools-4.22.1

Description

Xen tools including QEMU and xl

Added to portage

2026-12-03

xmltodict - 1.0.5
Ebuild name:

dev-python/xmltodict-1.0.5

Description

Makes working with XML feel like you are working with JSON

Added to portage

2026-12-03

xz-utils - 5.8.5
Ebuild name:

app-arch/xz-utils-5.8.5

Description

Utils for managing LZMA compressed files

Added to portage

2026-12-03

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