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:

81542

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-10-14
aiostream - 0.7.1
Ebuild name:

dev-python/aiostream-0.7.1

Description

Generator-based operators for asynchronous iteration

Added to portage

2025-10-14

asciidoctor - 2.0.24
Ebuild name:

dev-ruby/asciidoctor-2.0.24

Description

Processor for converting AsciiDoc into HTML 5, DocBook 4.5 and other fo

Added to portage

2025-10-14

awscli - 1.42.51
Ebuild name:

app-admin/awscli-1.42.51

Description

Universal Command Line Environment for AWS

Added to portage

2025-10-14

boto3 - 1.40.51
Ebuild name:

dev-python/boto3-1.40.51

Description

The AWS SDK for Python

Added to portage

2025-10-14

botocore - 1.40.51
Ebuild name:

dev-python/botocore-1.40.51

Description

Low-level, data-driven core of boto 3

Added to portage

2025-10-14

braintree - 4.39.0
Ebuild name:

dev-python/braintree-4.39.0

Description

Braintree Python Library

Added to portage

2025-10-14

cargo-nextest - 0.9.106
Ebuild name:

dev-util/cargo-nextest-0.9.106

Description

Next-generation test runner for Rust

Added to portage

2025-10-14

cftime - 1.6.5
Ebuild name:

dev-python/cftime-1.6.5

Description

Time-handling functionality from netcdf4-python

Added to portage

2025-10-14

charset-normalizer - 3.4.4
Ebuild name:

dev-python/charset-normalizer-3.4.4

Description

The Real First Universal Charset Detector

Added to portage

2025-10-14

dash - 0.5.13.1
Ebuild name:

app-shells/dash-0.5.13.1

Description

Debian Almquist Shell

Added to portage

2025-10-14

dulwich - 0.24.3
Ebuild name:

dev-python/dulwich-0.24.3

Description

Pure-Python implementation of the Git file formats and protocols

Added to portage

2025-10-14

dulwich - 0.24.3-r1
Ebuild name:

dev-python/dulwich-0.24.3-r1

Description

Pure-Python implementation of the Git file formats and protocols

Added to portage

2025-10-14

fennel - 1.6.0
Ebuild name:

dev-lang/fennel-1.6.0

Description

Lisp-like language that compiles to Lua

Added to portage

2025-10-14

firefox - 140.4.0
Ebuild name:

www-client/firefox-140.4.0

Description

Firefox Web Browser

Added to portage

2025-10-14

firefox - 144.0
Ebuild name:

www-client/firefox-144.0

Description

Firefox Web Browser

Added to portage

2025-10-14

firefox-bin - 140.4.0
Ebuild name:

www-client/firefox-bin-140.4.0

Description

Firefox Web Browser

Added to portage

2025-10-14

gallery-dl - 1.30.10
Ebuild name:

net-misc/gallery-dl-1.30.10

Description

Download image galleries and collections from several image hosting sit

Added to portage

2025-10-14

gnome-applets - 3.58.0
Ebuild name:

gnome-base/gnome-applets-3.58.0

Description

Applets for the GNOME Flashback Panel

Added to portage

2025-10-14

gnome-flashback - 3.58.0
Ebuild name:

gnome-base/gnome-flashback-3.58.0

Description

GNOME Flashback session

Added to portage

2025-10-14

gnome-panel - 3.58.1
Ebuild name:

gnome-base/gnome-panel-3.58.1

Description

The GNOME Flashback Panel

Added to portage

2025-10-14

h5py - 3.15.0
Ebuild name:

dev-python/h5py-3.15.0

Description

Simple Python interface to HDF5 files

Added to portage

2025-10-14

hcloud - 2.9.0
Ebuild name:

dev-python/hcloud-2.9.0

Description

Official Hetzner Cloud python library

Added to portage

2025-10-14

inline-snapshot - 0.29.4
Ebuild name:

dev-python/inline-snapshot-0.29.4

Description

Create and update inline snapshots in your Python tests

Added to portage

2025-10-14

ipykernel - 7.0.0
Ebuild name:

dev-python/ipykernel-7.0.0

Description

IPython Kernel for Jupyter

Added to portage

2025-10-14

jellyfin-bin - 10.11.0_rc9
Ebuild name:

www-apps/jellyfin-bin-10.11.0_rc9

Description

Jellyfin puts you in control of managing and streaming your media

Added to portage

2025-10-14

kdenlive - 25.08.2-r1
Ebuild name:

kde-apps/kdenlive-25.08.2-r1

Description

Non-linear video editing suite by KDE

Added to portage

2025-10-14

metacity - 3.58.1
Ebuild name:

x11-wm/metacity-3.58.1

Description

GNOME Flashback window manager

Added to portage

2025-10-14

mpmath - 1.4.0_beta2
Ebuild name:

dev-python/mpmath-1.4.0_beta2

Description

Python library for arbitrary-precision floating-point arithmetic

Added to portage

2025-10-14

msmtp - 1.8.32
Ebuild name:

mail-mta/msmtp-1.8.32

Description

An SMTP client and SMTP plugin for mail user agents such as Mutt

Added to portage

2025-10-14

muon - 0.5.0
Ebuild name:

dev-build/muon-0.5.0

Description

A meson-compatible build system

Added to portage

2025-10-14

narwhals - 2.8.0
Ebuild name:

dev-python/narwhals-2.8.0

Description

Extremely lightweight compatibility layer between dataframe libraries

Added to portage

2025-10-14

netcdf4 - 1.7.3
Ebuild name:

dev-python/netcdf4-1.7.3

Description

Python/numpy interface to the netCDF C library

Added to portage

2025-10-14

newsboat - 2.41
Ebuild name:

net-news/newsboat-2.41

Description

An RSS/Atom feed reader for text terminals

Added to portage

2025-10-14

nss - 3.112.2
Ebuild name:

dev-libs/nss-3.112.2

Description

Mozilla's Network Security Services library that implements PKI support

Added to portage

2025-10-14

numexpr - 2.14.1
Ebuild name:

dev-python/numexpr-2.14.1

Description

Fast numerical array expression evaluator for Python and NumPy

Added to portage

2025-10-14

precis-i18n - 1.1.2
Ebuild name:

dev-python/precis-i18n-1.1.2

Description

Internationalized Usernames and Passwords

Added to portage

2025-10-14

prowlarr-bin - 2.1.4.5212
Ebuild name:

www-apps/prowlarr-bin-2.1.4.5212

Description

An indexer manager/proxy to integrate with your various PVR apps

Added to portage

2025-10-14

pydantic - 2.12.1
Ebuild name:

dev-python/pydantic-2.12.1

Description

Data parsing and validation using Python type hints

Added to portage

2025-10-14

referencing - 0.37.0
Ebuild name:

dev-python/referencing-0.37.0

Description

Cross-specification JSON referencing (JSON Schema, OpenAPI...)

Added to portage

2025-10-14

sanoid - 2.3.0-r1
Ebuild name:

sys-fs/sanoid-2.3.0-r1

Description

Policy-driven snapshot management and replication tools for OpenZFS.

Added to portage

2025-10-14

sanoid - 9999
Ebuild name:

sys-fs/sanoid-9999

Description

Policy-driven snapshot management and replication tools for OpenZFS.

Added to portage

2025-10-14

sdoc - 2.6.4
Ebuild name:

dev-ruby/sdoc-2.6.4

Description

rdoc generator html with javascript search index

Added to portage

2025-10-14

sqlglot - 27.27.0
Ebuild name:

dev-python/sqlglot-27.27.0

Description

An easily customizable SQL parser and transpiler

Added to portage

2025-10-14

telegram-desktop - 6.2.3
Ebuild name:

net-im/telegram-desktop-6.2.3

Description

Official desktop client for Telegram

Added to portage

2025-10-14

testfixtures - 9.2.0
Ebuild name:

dev-python/testfixtures-9.2.0

Description

A collection of helpers and mock objects for unit tests and doc tests

Added to portage

2025-10-14

unearth - 0.18.0
Ebuild name:

dev-python/unearth-0.18.0

Description

A utility to fetch and download python packages

Added to portage

2025-10-14

xor-analyze - 0.5-r1
Ebuild name:

app-crypt/xor-analyze-0.5-r1

Description

Program for cryptanalyzing xor 'encryption' with variable key length

Added to portage

2025-10-14

yubihsm-connector - 3.0.4
Ebuild name:

app-crypt/yubihsm-connector-3.0.4

Description

Server to expose YubiHSM 2 to network

Added to portage

2025-10-14

yubihsm-shell - 2.6.0
Ebuild name:

app-crypt/yubihsm-shell-2.6.0

Description

Components used to interact with the YubiHSM 2

Added to portage

2025-10-14

2025-10-13
XML-LibXML - 2.21.0-r1
Ebuild name:

dev-perl/XML-LibXML-2.21.0-r1

Description

Perl binding for libxml2

Added to portage

2025-10-13

cachetools - 6.2.1
Ebuild name:

dev-python/cachetools-6.2.1

Description

Extensible memoizing collections and decorators

Added to portage

2025-10-13

ceph - 20.1.1
Ebuild name:

sys-cluster/ceph-20.1.1

Description

Ceph distributed filesystem

Added to portage

2025-10-13

claude-code - 2.0.14
Ebuild name:

dev-util/claude-code-2.0.14

Description

Claude Code - an agentic coding tool by Anthropic

Added to portage

2025-10-13

crc32c - 2.7.1_p0
Ebuild name:

dev-python/crc32c-2.7.1_p0

Description

CRC32c algorithm in hardware and software

Added to portage

2025-10-13

dfu-programmer - 1.1.0
Ebuild name:

dev-embedded/dfu-programmer-1.1.0

Description

A Device Firmware Update based USB programmer for Atmel chips

Added to portage

2025-10-13

erb - 5.1.1
Ebuild name:

dev-ruby/erb-5.1.1

Description

An easy to use but powerful templating system for Ruby

Added to portage

2025-10-13

firefox-bin - 144.0
Ebuild name:

www-client/firefox-bin-144.0

Description

Firefox Web Browser

Added to portage

2025-10-13

freerdp - 3.17.2-r1
Ebuild name:

net-misc/freerdp-3.17.2-r1

Description

Free implementation of the Remote Desktop Protocol

Added to portage

2025-10-13

gcc - 16.0.0_p20251012
Ebuild name:

sys-devel/gcc-16.0.0_p20251012

Description

The GNU Compiler Collection

Added to portage

2025-10-13

gentoo-sources - 6.12.52
Ebuild name:

sys-kernel/gentoo-sources-6.12.52

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2025-10-13

gentoo-sources - 6.16.12
Ebuild name:

sys-kernel/gentoo-sources-6.16.12

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2025-10-13

gentoo-sources - 6.17.2
Ebuild name:

sys-kernel/gentoo-sources-6.17.2

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2025-10-13

gentoo-sources - 6.6.111
Ebuild name:

sys-kernel/gentoo-sources-6.6.111

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2025-10-13

git-sources - 6.18_rc1
Ebuild name:

sys-kernel/git-sources-6.18_rc1

Description

The very latest -git version of the Linux kernel

Added to portage

2025-10-13

gle - 4.3.8
Ebuild name:

sci-visualization/gle-4.3.8

Description

Graphics Layout Engine

Added to portage

2025-10-13

idna - 3.11
Ebuild name:

dev-python/idna-3.11

Description

Internationalized Domain Names in Applications (IDNA)

Added to portage

2025-10-13

jc - 1.25.6
Ebuild name:

dev-python/jc-1.25.6

Description

Converts the output of popular command-line tools and file-types to JSON

Added to portage

2025-10-13

lsd - 1.2.0
Ebuild name:

sys-apps/lsd-1.2.0

Description

An ls command with a lot of pretty colors and some other stuff.

Added to portage

2025-10-13

marble - 25.08.2-r1
Ebuild name:

kde-apps/marble-25.08.2-r1

Description

Virtual Globe and World Atlas to learn more about Earth

Added to portage

2025-10-13

nuitka - 2.8.1
Ebuild name:

dev-python/nuitka-2.8.1

Description

Python to native compiler

Added to portage

2025-10-13

pam - 1.7.1-r2
Ebuild name:

sys-libs/pam-1.7.1-r2

Description

Linux-PAM (Pluggable Authentication Modules)

Added to portage

2025-10-13

pambase - 20251013
Ebuild name:

sys-auth/pambase-20251013

Description

PAM base configuration files

Added to portage

2025-10-13

pocl - 7.1
Ebuild name:

dev-libs/pocl-7.1

Description

Portable Computing Language (an implementation of OpenCL)

Added to portage

2025-10-13

pylint - 4.0.0
Ebuild name:

dev-python/pylint-4.0.0

Description

Python code static checker

Added to portage

2025-10-13

pytest-fixture-classes - 1.0.4
Ebuild name:

dev-python/pytest-fixture-classes-1.0.4

Description

Fixtures as classes

Added to portage

2025-10-13

reaper-bin - 7.48
Ebuild name:

media-sound/reaper-bin-7.48

Description

Digital audio workstation

Added to portage

2025-10-13

recog - 3.1.23
Ebuild name:

dev-ruby/recog-3.1.23

Description

Pattern recognition for hosts, services, and content

Added to portage

2025-10-13

sequel - 5.97.0
Ebuild name:

dev-ruby/sequel-5.97.0

Description

A lightweight database toolkit for Ruby

Added to portage

2025-10-13

setuptools-scm - 9.2.1
Ebuild name:

dev-python/setuptools-scm-9.2.1

Description

Manage versions by scm tags via setuptools

Added to portage

2025-10-13

shadow - 0
Ebuild name:

acct-group/shadow-0

Description

Added to portage

2025-10-13

shadow - 4.14.8-r1
Ebuild name:

sys-apps/shadow-4.14.8-r1

Description

Utilities to deal with user accounts

Added to portage

2025-10-13

systemd - 258.1
Ebuild name:

sys-apps/systemd-258.1

Description

System and service manager for Linux

Added to portage

2025-10-13

tlp - 1.8.0-r1
Ebuild name:

sys-power/tlp-1.8.0-r1

Description

Optimize laptop battery life

Added to portage

2025-10-13

tumbler - 4.20.1
Ebuild name:

xfce-base/tumbler-4.20.1

Description

A thumbnail service for Thunar

Added to portage

2025-10-13

uutf - 1.0.4
Ebuild name:

dev-ml/uutf-1.0.4

Description

Non-blocking streaming Unicode codec for OCaml

Added to portage

2025-10-13

vanilla-sources - 6.12.52
Ebuild name:

sys-kernel/vanilla-sources-6.12.52

Description

Full sources for the Linux kernel

Added to portage

2025-10-13

vanilla-sources - 6.16.12
Ebuild name:

sys-kernel/vanilla-sources-6.16.12

Description

Full sources for the Linux kernel

Added to portage

2025-10-13

vanilla-sources - 6.17.2
Ebuild name:

sys-kernel/vanilla-sources-6.17.2

Description

Full sources for the Linux kernel

Added to portage

2025-10-13

vanilla-sources - 6.6.111
Ebuild name:

sys-kernel/vanilla-sources-6.6.111

Description

Full sources for the Linux kernel

Added to portage

2025-10-13

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: 49.4 ms