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:

82356

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-09
2025-12-08
apprise - 1.9.6
Ebuild name:

dev-python/apprise-1.9.6

Description

Push Notifications that work with just about every platform

Added to portage

2025-12-08

basket - 2.49b_p20251207
Ebuild name:

kde-misc/basket-2.49b_p20251207

Description

Multiple information organizer - a DropDrawers clone

Added to portage

2025-12-08

black - 25.12.0
Ebuild name:

dev-python/black-25.12.0

Description

The uncompromising Python code formatter

Added to portage

2025-12-08

blas-lapack-aux-wrapper - 4
Ebuild name:

sci-libs/blas-lapack-aux-wrapper-4

Description

BLAS/LAPACK wrappers for FlexiBLAS

Added to portage

2025-12-08

blockbuster - 1.5.26
Ebuild name:

dev-python/blockbuster-1.5.26

Description

Utility to detect blocking calls in the async event loop

Added to portage

2025-12-08

cdrdao - 1.2.6
Ebuild name:

app-cdr/cdrdao-1.2.6

Description

Burn CDs in disk-at-once mode with a command line interface

Added to portage

2025-12-08

claude-code - 2.0.61
Ebuild name:

dev-util/claude-code-2.0.61

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2025-12-08

cmd2 - 3.0.0
Ebuild name:

dev-python/cmd2-3.0.0

Description

Extra features for standard library's cmd module

Added to portage

2025-12-08

double-conversion - 3.4.0
Ebuild name:

dev-libs/double-conversion-3.4.0

Description

Binary-decimal and decimal-binary conversion routines for IEEE dou

Added to portage

2025-12-08

e3-core - 22.6.0-r5
Ebuild name:

dev-ada/e3-core-22.6.0-r5

Description

Ease the development of portable automated build systems

Added to portage

2025-12-08

eisl - 5.61
Ebuild name:

dev-lang/eisl-5.61

Description

Interpreter and compiler compatible with the ISLisp standard

Added to portage

2025-12-08

elogviewer - 3.3_pre20251208
Ebuild name:

app-portage/elogviewer-3.3_pre20251208

Description

Elog viewer for Gentoo

Added to portage

2025-12-08

firefox-bin - 146.0-r1
Ebuild name:

www-client/firefox-bin-146.0-r1

Description

Firefox Web Browser

Added to portage

2025-12-08

fsautocomplete - 0.82.0
Ebuild name:

dev-dotnet/fsautocomplete-0.82.0

Description

F language server using the Language Server Protocol

Added to portage

2025-12-08

gcc - 16.0.0_p20251207
Ebuild name:

sys-devel/gcc-16.0.0_p20251207

Description

The GNU Compiler Collection

Added to portage

2025-12-08

gmpy2 - 2.3.0_alpha3
Ebuild name:

dev-python/gmpy2-2.3.0_alpha3

Description

Python bindings for GMP, MPC, MPFR and MPIR libraries

Added to portage

2025-12-08

guildmaster - 0_pre20250712
Ebuild name:

dev-build/guildmaster-0_pre20250712

Description

FIFO-like jobserver node via CUSE

Added to portage

2025-12-08

httpx-socks - 0.11.0
Ebuild name:

dev-python/httpx-socks-0.11.0

Description

Proxy (HTTP, SOCKS) transports for httpx

Added to portage

2025-12-08

incus - 6.19.1
Ebuild name:

app-containers/incus-6.19.1

Description

Modern, secure and powerful system container and virtual machine manage

Added to portage

2025-12-08

jitterentropy - 3.6.3
Ebuild name:

app-crypt/jitterentropy-3.6.3

Description

Hardware RNG based on CPU timing jitter

Added to portage

2025-12-08

koleo-cli - 0.2.137.24.2
Ebuild name:

app-misc/koleo-cli-0.2.137.24.2

Description

A simple CLI for koleo.pl railway planner

Added to portage

2025-12-08

libdrm - 2.4.130
Ebuild name:

x11-libs/libdrm-2.4.130

Description

X.Org libdrm library

Added to portage

2025-12-08

libinput - 1.30.1
Ebuild name:

dev-libs/libinput-1.30.1

Description

Library to handle input devices in Wayland

Added to portage

2025-12-08

libtmux - 0.52.1
Ebuild name:

dev-python/libtmux-0.52.1

Description

Typed library that provides an ORM wrapper for tmux, a terminal multiplex

Added to portage

2025-12-08

mistletoe - 1.5.1
Ebuild name:

dev-python/mistletoe-1.5.1

Description

A fast, extensible Markdown parser in pure Python

Added to portage

2025-12-08

nftables - 1.1.6
Ebuild name:

net-firewall/nftables-1.1.6

Description

Linux kernel firewall, NAT and packet mangling tools

Added to portage

2025-12-08

pdns-recursor - 5.3.3
Ebuild name:

net-dns/pdns-recursor-5.3.3

Description

The PowerDNS Recursor

Added to portage

2025-12-08

pfuture - 1.10.3
Ebuild name:

app-emacs/pfuture-1.10.3

Description

Simple wrapper around asynchronous processes

Added to portage

2025-12-08

php-mode - 1.27.0
Ebuild name:

app-emacs/php-mode-1.27.0

Description

GNU Emacs major mode for editing PHP code

Added to portage

2025-12-08

pymdown-extensions - 10.18
Ebuild name:

dev-python/pymdown-extensions-10.18

Description

Extensions for Python Markdown

Added to portage

2025-12-08

pypdf - 6.4.1
Ebuild name:

dev-python/pypdf-6.4.1

Description

Python library to work with PDF files

Added to portage

2025-12-08

pyzstd - 0.19.0
Ebuild name:

dev-python/pyzstd-0.19.0

Description

Support for Zstandard (zstd) compression

Added to portage

2025-12-08

racket-mode - 1_p20251107
Ebuild name:

app-emacs/racket-mode-1_p20251107

Description

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

Added to portage

2025-12-08

rsyslog - 8.2512.0
Ebuild name:

app-admin/rsyslog-8.2512.0

Description

An enhanced multi-threaded syslogd with database support and more

Added to portage

2025-12-08

spawn - 25.0.0-r4
Ebuild name:

dev-ada/spawn-25.0.0-r4

Description

Simple API to spawn processes

Added to portage

2025-12-08

xterm - 404
Ebuild name:

x11-terms/xterm-404

Description

Terminal Emulator for X Windows

Added to portage

2025-12-08

xvfbwrapper - 0.2.16
Ebuild name:

dev-python/xvfbwrapper-0.2.16

Description

Python wrapper for running a display inside X virtual framebuffer

Added to portage

2025-12-08

yt-dlp - 2025.12.08
Ebuild name:

net-misc/yt-dlp-2025.12.08

Description

youtube-dl fork with additional features and fixes

Added to portage

2025-12-08

yt-dlp-ejs - 0.3.2
Ebuild name:

dev-python/yt-dlp-ejs-0.3.2

Description

External JavaScript for yt-dlp supporting many runtimes

Added to portage

2025-12-08

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