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:

82290

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-04
djbdns - 1.05-r42
Ebuild name:

net-dns/djbdns-1.05-r42

Description

Collection of DNS client/server software

Added to portage

2025-12-04

poppler - 25.12.0
Ebuild name:

app-text/poppler-25.12.0

Description

PDF rendering library based on the xpdf-3.0 code base

Added to portage

2025-12-04

2025-12-03
ansible-compat - 25.12.0
Ebuild name:

dev-python/ansible-compat-25.12.0

Description

Contains functions that facilitate working with various versions

Added to portage

2025-12-03

aws-sam-translator - 1.105.0
Ebuild name:

dev-python/aws-sam-translator-1.105.0

Description

A library that transform SAM templates into AWS CloudFormatio

Added to portage

2025-12-03

awscli - 1.43.7
Ebuild name:

app-admin/awscli-1.43.7

Description

Universal Command Line Environment for AWS

Added to portage

2025-12-03

borgbackup - 1.4.3
Ebuild name:

app-backup/borgbackup-1.4.3

Description

Deduplicating backup program with compression and authenticated encrypt

Added to portage

2025-12-03

boto3 - 1.42.1
Ebuild name:

dev-python/boto3-1.42.1

Description

The AWS SDK for Python

Added to portage

2025-12-03

botocore - 1.42.1
Ebuild name:

dev-python/botocore-1.42.1

Description

Low-level, data-driven core of boto 3

Added to portage

2025-12-03

django - 4.2.27
Ebuild name:

dev-python/django-4.2.27

Description

High-level Python web framework

Added to portage

2025-12-03

django - 5.1.15
Ebuild name:

dev-python/django-5.1.15

Description

High-level Python web framework

Added to portage

2025-12-03

django - 5.2.9
Ebuild name:

dev-python/django-5.2.9

Description

High-level Python web framework

Added to portage

2025-12-03

gentoo-sources - 6.18.0
Ebuild name:

sys-kernel/gentoo-sources-6.18.0

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2025-12-03

icaclient - 25.05.0.44-r1
Ebuild name:

net-misc/icaclient-25.05.0.44-r1

Description

ICA Client for Citrix Presentation servers

Added to portage

2025-12-03

indilib - 2.1.7
Ebuild name:

sci-libs/indilib-2.1.7

Description

INDI Astronomical Control Protocol library

Added to portage

2025-12-03

krita - 6.0.0_alpha_pre20251203
Ebuild name:

media-gfx/krita-6.0.0_alpha_pre20251203

Description

Free digital painting application. Digital Painting, Creati

Added to portage

2025-12-03

libnftnl - 1.3.1
Ebuild name:

net-libs/libnftnl-1.3.1

Description

Netlink API to the in-kernel nf_tables subsystem

Added to portage

2025-12-03

libsdl2 - 2.32.60
Ebuild name:

media-libs/libsdl2-2.32.60

Description

Simple Direct Media Layer

Added to portage

2025-12-03

libsdl3 - 3.2.28
Ebuild name:

media-libs/libsdl3-3.2.28

Description

Simple Direct Media Layer

Added to portage

2025-12-03

libwebsockets - 4.5.2
Ebuild name:

net-libs/libwebsockets-4.5.2

Description

A flexible pure-C library for implementing network protocols

Added to portage

2025-12-03

linux-docs - 6.18
Ebuild name:

sys-kernel/linux-docs-6.18

Description

Developer documentation generated from the Linux kernel

Added to portage

2025-12-03

linux-firmware - 20251125_p20251202
Ebuild name:

sys-kernel/linux-firmware-20251125_p20251202

Description

Linux firmware files

Added to portage

2025-12-03

numpydoc - 1.10.0
Ebuild name:

dev-python/numpydoc-1.10.0

Description

Sphinx extension to support docstrings in Numpy format

Added to portage

2025-12-03

nwjs - 0.100.1
Ebuild name:

dev-libs/nwjs-0.100.1

Description

Framework that lets you call all Node.js modules directly from the DOM

Added to portage

2025-12-03

nwjs - 0.104.1-r1
Ebuild name:

dev-libs/nwjs-0.104.1-r1

Description

Framework that lets you call all Node.js modules directly from the DOM

Added to portage

2025-12-03

nwjs - 0.106.0
Ebuild name:

dev-libs/nwjs-0.106.0

Description

Framework that lets you call all Node.js modules directly from the DOM

Added to portage

2025-12-03

nwjs - 0.86.0
Ebuild name:

dev-libs/nwjs-0.86.0

Description

Framework that lets you call all Node.js modules directly from the DOM

Added to portage

2025-12-03

openhab-bin - 5.0.2-r1
Ebuild name:

app-misc/openhab-bin-5.0.2-r1

Description

An open-source automation software for your home

Added to portage

2025-12-03

openhab-bin - 5.0.3-r1
Ebuild name:

app-misc/openhab-bin-5.0.3-r1

Description

An open-source automation software for your home

Added to portage

2025-12-03

pecl-mongodb - 1.16.2-r1
Ebuild name:

dev-php/pecl-mongodb-1.16.2-r1

Description

MongoDB database driver for PHP

Added to portage

2025-12-03

php-mode - 9999
Ebuild name:

app-emacs/php-mode-9999

Description

GNU Emacs major mode for editing PHP code

Added to portage

2025-12-03

pinentry - 0.1_p20250408
Ebuild name:

app-emacs/pinentry-0.1_p20250408

Description

GnuPG Pinentry server implementation for Emacs

Added to portage

2025-12-03

pkg-info - 0.6
Ebuild name:

app-emacs/pkg-info-0.6

Description

Provide information about Emacs packages

Added to portage

2025-12-03

planner - 3.42-r1
Ebuild name:

app-emacs/planner-3.42-r1

Description

Maintain a local Wiki using Emacs-friendly markup

Added to portage

2025-12-03

popcorntime-bin - 0.5.1-r2
Ebuild name:

media-video/popcorntime-bin-0.5.1-r2

Description

BitTorrent client that includes an integrated media player

Added to portage

2025-12-03

psycopg - 3.3.1
Ebuild name:

dev-python/psycopg-3.3.1

Description

PostgreSQL database adapter for Python

Added to portage

2025-12-03

pydyf - 0.12.1
Ebuild name:

dev-python/pydyf-0.12.1

Description

A low-level PDF generator

Added to portage

2025-12-03

pymongo - 4.15.5
Ebuild name:

dev-python/pymongo-4.15.5

Description

Python driver for MongoDB

Added to portage

2025-12-03

pyside - 6.10.1-r1
Ebuild name:

dev-python/pyside-6.10.1-r1

Description

Python bindings for the Qt framework

Added to portage

2025-12-03

pytest-httpx - 0.36.0
Ebuild name:

dev-python/pytest-httpx-0.36.0

Description

Send responses to HTTPX using pytest

Added to portage

2025-12-03

python - 0.3.13.10
Ebuild name:

dev-lang/python-0.3.13.10

Description

Freethreading (no-GIL) version of Python programming language

Added to portage

2025-12-03

python - 0.3.14.1
Ebuild name:

dev-lang/python-0.3.14.1

Description

Freethreading (no-GIL) version of Python programming language

Added to portage

2025-12-03

python - 3.13.10
Ebuild name:

dev-lang/python-3.13.10

Description

An interpreted, interactive, object-oriented programming language

Added to portage

2025-12-03

python - 3.14.1
Ebuild name:

dev-lang/python-3.14.1

Description

An interpreted, interactive, object-oriented programming language

Added to portage

2025-12-03

python-tests - 0.3.13.10
Ebuild name:

dev-python/python-tests-0.3.13.10

Description

Test modules from dev-lang/python

Added to portage

2025-12-03

python-tests - 0.3.14.1
Ebuild name:

dev-python/python-tests-0.3.14.1

Description

Test modules from dev-lang/python

Added to portage

2025-12-03

python-tests - 3.13.10
Ebuild name:

dev-python/python-tests-3.13.10

Description

Test modules from dev-lang/python

Added to portage

2025-12-03

python-tests - 3.14.1
Ebuild name:

dev-python/python-tests-3.14.1

Description

Test modules from dev-lang/python

Added to portage

2025-12-03

pyzotero - 1.7.6
Ebuild name:

dev-python/pyzotero-1.7.6

Description

A Python client for the Zotero API

Added to portage

2025-12-03

roundcube - 1.7_beta2
Ebuild name:

mail-client/roundcube-1.7_beta2

Description

A browser-based multilingual IMAP client with an application-like u

Added to portage

2025-12-03

ruff - 0.14.7
Ebuild name:

dev-util/ruff-0.14.7

Description

An extremely fast Python linter, written in Rust

Added to portage

2025-12-03

sabctools - 9.0.0
Ebuild name:

dev-python/sabctools-9.0.0

Description

Module providing raw yEnc encoding/decoding for SABnzbd

Added to portage

2025-12-03

safetensors - 0.7.0
Ebuild name:

sci-ml/safetensors-0.7.0

Description

Simple, safe way to store and distribute tensors

Added to portage

2025-12-03

sphinx-gallery - 0.20.0
Ebuild name:

dev-python/sphinx-gallery-0.20.0

Description

Sphinx extension to automatically generate an examples gallery

Added to portage

2025-12-03

sqlglot - 28.1.0
Ebuild name:

dev-python/sqlglot-28.1.0

Description

An easily customizable SQL parser and transpiler

Added to portage

2025-12-03

sybil - 9.3.0
Ebuild name:

dev-python/sybil-9.3.0

Description

Automated testing for the examples in your documentation

Added to portage

2025-12-03

syncthing - 2.0.12
Ebuild name:

net-p2p/syncthing-2.0.12

Description

Open Source Continuous File Synchronization

Added to portage

2025-12-03

tmuxp - 1.59.0
Ebuild name:

app-misc/tmuxp-1.59.0

Description

tmux session manager. built on libtmux

Added to portage

2025-12-03

urwid - 3.0.4
Ebuild name:

dev-python/urwid-3.0.4

Description

Curses-based user interface library for Python

Added to portage

2025-12-03

uv - 0.9.15
Ebuild name:

dev-python/uv-0.9.15

Description

A Python package installer and resolver, written in Rust

Added to portage

2025-12-03

uv-build - 0.9.15
Ebuild name:

dev-python/uv-build-0.9.15

Description

PEP517 uv build backend

Added to portage

2025-12-03

weasyprint - 67.0
Ebuild name:

dev-python/weasyprint-67.0

Description

Visual rendering engine for HTML and CSS that can export to PDF

Added to portage

2025-12-03

wordpress - 6.9
Ebuild name:

www-apps/wordpress-6.9

Description

Wordpress PHP and MySQL based content management system (CMS)

Added to portage

2025-12-03

xkbcomp - 1.5.0
Ebuild name:

x11-apps/xkbcomp-1.5.0

Description

XKB keyboard description compiler

Added to portage

2025-12-03

zlib-ng - 2.3.2
Ebuild name:

sys-libs/zlib-ng-2.3.2

Description

Fork of the zlib data compression library

Added to portage

2025-12-03

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