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:

82645

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-29
array-api-compat - 1.13.0
Ebuild name:

dev-python/array-api-compat-1.13.0

Description

Array API standard compatibility wrapper over NumPy and others

Added to portage

2025-12-29

coverage - 7.13.1
Ebuild name:

dev-python/coverage-7.13.1

Description

Code coverage measurement for Python

Added to portage

2025-12-29

elementpath - 5.1.0
Ebuild name:

dev-python/elementpath-5.1.0

Description

XPath 1.0/2.0 parsers and selectors for ElementTree and lxml

Added to portage

2025-12-29

git-sources - 6.19_rc3
Ebuild name:

sys-kernel/git-sources-6.19_rc3

Description

The very latest -git version of the Linux kernel

Added to portage

2025-12-29

hugin - 2025.0.1
Ebuild name:

media-gfx/hugin-2025.0.1

Description

GUI for the creation & processing of panoramic images

Added to portage

2025-12-29

lcov - 2.4
Ebuild name:

dev-util/lcov-2.4

Description

A graphical front-end for GCC's coverage testing tool gcov

Added to portage

2025-12-29

mediafile - 0.14.0
Ebuild name:

dev-python/mediafile-0.14.0

Description

Read and write audio files' tags in Python

Added to portage

2025-12-29

moto - 5.1.19
Ebuild name:

dev-python/moto-5.1.19

Description

Mock library for boto

Added to portage

2025-12-29

netavark - 1.17.1
Ebuild name:

app-containers/netavark-1.17.1

Description

A container network stack

Added to portage

2025-12-29

newsboat - 2.42
Ebuild name:

net-news/newsboat-2.42

Description

An RSS/Atom feed reader for text terminals

Added to portage

2025-12-29

parseclj - 1.1.1
Ebuild name:

app-emacs/parseclj-1.1.1

Description

Clojure Parser for Emacs Lisp

Added to portage

2025-12-29

pwsh - 7.5.4-r2
Ebuild name:

app-shells/pwsh-7.5.4-r2

Description

Cross-platform automation and configuration tool

Added to portage

2025-12-29

qmidiarp - 0.7.2
Ebuild name:

media-sound/qmidiarp-0.7.2

Description

Arpeggiator, sequencer and MIDI LFO for ALSA

Added to portage

2025-12-29

sedlex - 3.7
Ebuild name:

dev-ml/sedlex-3.7

Description

Added to portage

2025-12-29

socket-burst-dampener - 1.3.3
Ebuild name:

net-misc/socket-burst-dampener-1.3.3

Description

A daemon that spawns one command per connection, and dampens c

Added to portage

2025-12-29

tldextract - 5.3.1
Ebuild name:

dev-python/tldextract-5.3.1

Description

Accurately separate the TLD from the registered domain and subdomains o

Added to portage

2025-12-29

tlfloat - 1.15.0_p20250711
Ebuild name:

dev-cpp/tlfloat-1.15.0_p20250711

Description

C++ template library for floating point operations

Added to portage

2025-12-29

types-psutil - 7.2.0.20251228
Ebuild name:

dev-python/types-psutil-7.2.0.20251228

Description

Typing stubs for psutil

Added to portage

2025-12-29

xwaylandvideobridge - 0.4.0_p20250215-r1
Ebuild name:

gui-apps/xwaylandvideobridge-0.4.0_p20250215-r1

Description

Screenshare Wayland windows to XWayland apps

Added to portage

2025-12-29

2025-12-28
aotriton-bin - 0.11.1b-r1
Ebuild name:

sci-libs/aotriton-bin-0.11.1b-r1

Description

Ahead of Time (AOT) Triton Math Library (binary package)

Added to portage

2025-12-28

aotriton-bin - 0.11b-r1
Ebuild name:

sci-libs/aotriton-bin-0.11b-r1

Description

Ahead of Time (AOT) Triton Math Library (binary package)

Added to portage

2025-12-28

automake-vanilla - 1.11.6
Ebuild name:

dev-build/automake-vanilla-1.11.6

Description

Used to generate Makefile.in from Makefile.am

Added to portage

2025-12-28

automake-vanilla - 1.15.1
Ebuild name:

dev-build/automake-vanilla-1.15.1

Description

Used to generate Makefile.in from Makefile.am

Added to portage

2025-12-28

automake-vanilla - 1.16.5
Ebuild name:

dev-build/automake-vanilla-1.16.5

Description

Used to generate Makefile.in from Makefile.am

Added to portage

2025-12-28

caffe2 - 2.9.1-r2
Ebuild name:

sci-ml/caffe2-2.9.1-r2

Description

A deep learning framework

Added to portage

2025-12-28

clr-loader - 0.2.9
Ebuild name:

dev-python/clr-loader-0.2.9

Description

Generic pure Python loader for .NET runtimes

Added to portage

2025-12-28

dry-core - 1.2.0
Ebuild name:

dev-ruby/dry-core-1.2.0

Description

A toolset of small support modules used throughout the dry-rb ecosystem

Added to portage

2025-12-28

duplicati - 2.2.0.1.2025.11.09
Ebuild name:

app-backup/duplicati-2.2.0.1.2025.11.09

Description

Backup client that securely stores encrypted, incremental,

Added to portage

2025-12-28

faraday-follow_redirects - 0.5.0
Ebuild name:

dev-ruby/faraday-follow_redirects-0.5.0

Description

Perform multipart-post requests using Faraday

Added to portage

2025-12-28

faraday-multipart - 1.2.0
Ebuild name:

dev-ruby/faraday-multipart-1.2.0

Description

Perform multipart-post requests using Faraday

Added to portage

2025-12-28

faraday-retry - 2.4.0
Ebuild name:

dev-ruby/faraday-retry-2.4.0

Description

Faraday adapter for Net

Added to portage

2025-12-28

gemato - 20.11
Ebuild name:

app-portage/gemato-20.11

Description

Stand-alone Manifest generation & verification tool

Added to portage

2025-12-28

homebank - 5.9.7
Ebuild name:

app-office/homebank-5.9.7

Description

Free, easy, personal accounting for everyone

Added to portage

2025-12-28

intellij-idea - 2025.3.1-r1
Ebuild name:

dev-util/intellij-idea-2025.3.1-r1

Description

A complete toolset for web, mobile and enterprise development

Added to portage

2025-12-28

intellij-idea - 2025.3.1-r2
Ebuild name:

dev-util/intellij-idea-2025.3.1-r2

Description

A complete toolset for web, mobile and enterprise development

Added to portage

2025-12-28

jdupes - 1.30.0-r2
Ebuild name:

app-misc/jdupes-1.30.0-r2

Description

Identify duplicate files on the filesystem

Added to portage

2025-12-28

joplin-desktop - 3.5.9
Ebuild name:

app-office/joplin-desktop-3.5.9

Description

Secure note taking and to-do app with synchronization capabilities

Added to portage

2025-12-28

langkit-contrib - 26.0.0
Ebuild name:

dev-ada/langkit-contrib-26.0.0

Description

A Python framework to generate language parsers - Contrib

Added to portage

2025-12-28

libadalang - 26.0.0
Ebuild name:

dev-ada/libadalang-26.0.0

Description

high performance semantic engine for the Ada programming language

Added to portage

2025-12-28

mptcpd - 0.14
Ebuild name:

net-misc/mptcpd-0.14

Description

Daemon that performs multipath TCP path management related operations.

Added to portage

2025-12-28

netcoredbg - 3.1.3.1062
Ebuild name:

dev-dotnet/netcoredbg-3.1.3.1062

Description

NetCoreDbg is a managed code debugger with MI interface for CoreCL

Added to portage

2025-12-28

nvc - 1.18.2-r1
Ebuild name:

sci-electronics/nvc-1.18.2-r1

Description

NVC is a VHDL compiler and simulator

Added to portage

2025-12-28

odamex - 12.0.0
Ebuild name:

games-engines/odamex-12.0.0

Description

Online multiplayer free software engine for DOOM

Added to portage

2025-12-28

pdf-reader - 2.15.1
Ebuild name:

dev-ruby/pdf-reader-2.15.1

Description

PDF parser conforming as much as possible to the PDF specification from

Added to portage

2025-12-28

pkg-info - 0.6-r1
Ebuild name:

app-emacs/pkg-info-0.6-r1

Description

Provide information about Emacs packages

Added to portage

2025-12-28

polychromatic - 0.9.6
Ebuild name:

sys-apps/polychromatic-0.9.6

Description

RGB lighting management software for GNU/Linux powered by OpenRazer

Added to portage

2025-12-28

puppet-mode - 0.4-r1
Ebuild name:

app-emacs/puppet-mode-0.4-r1

Description

Emacs major mode for editing Puppet manifests

Added to portage

2025-12-28

pygresql - 6.2.1
Ebuild name:

dev-python/pygresql-6.2.1

Description

A Python interface for the PostgreSQL database

Added to portage

2025-12-28

pytest-gitconfig - 0.9.0
Ebuild name:

dev-python/pytest-gitconfig-0.9.0

Description

Provide a Git config sandbox for testing

Added to portage

2025-12-28

scss-mode - 0.5.0_p20180123-r2
Ebuild name:

app-emacs/scss-mode-0.5.0_p20180123-r2

Description

Major mode for editing SCSS files in Emacs

Added to portage

2025-12-28

session - 2.4b-r1
Ebuild name:

app-emacs/session-2.4b-r1

Description

When you start Emacs, Session restores various variables from your last s

Added to portage

2025-12-28

sonarr-bin - 4.0.16.2946
Ebuild name:

www-apps/sonarr-bin-4.0.16.2946

Description

Sonarr is a Smart PVR for newsgroup and bittorrent users

Added to portage

2025-12-28

sqlite3 - 2.9.0
Ebuild name:

dev-ruby/sqlite3-2.9.0

Description

An extension library to access a SQLite database from Ruby

Added to portage

2025-12-28

sumibi - 0.7.4-r1
Ebuild name:

app-emacs/sumibi-0.7.4-r1

Description

Statistical Japanese input method using the Internet as a large corpus

Added to portage

2025-12-28

tempo-snippets - 0.1.5-r1
Ebuild name:

app-emacs/tempo-snippets-0.1.5-r1

Description

Visual insertion of tempo templates

Added to portage

2025-12-28

treepy - 0.1.2-r1
Ebuild name:

app-emacs/treepy-0.1.2-r1

Description

Generic tree traversing tools for Emacs Lisp

Added to portage

2025-12-28

visual-basic-mode - 1.5-r1
Ebuild name:

app-emacs/visual-basic-mode-1.5-r1

Description

A mode for editing Visual Basic programs

Added to portage

2025-12-28

yaml-mode - 0.0.16-r1
Ebuild name:

app-emacs/yaml-mode-0.0.16-r1

Description

A major mode for GNU Emacs for editing YAML files

Added to portage

2025-12-28

zenburn - 20110907-r2
Ebuild name:

app-emacs/zenburn-20110907-r2

Description

Zenburn color theme for Emacs

Added to portage

2025-12-28

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