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:

82649

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-30
awscli - 1.44.8
Ebuild name:

app-admin/awscli-1.44.8

Description

Universal Command Line Environment for AWS

Added to portage

2025-12-30

backports-zstd - 1.3.0
Ebuild name:

dev-python/backports-zstd-1.3.0

Description

Backport of PEP-784 adding Zstandard to the standard library

Added to portage

2025-12-30

boto3 - 1.42.18
Ebuild name:

dev-python/boto3-1.42.18

Description

The AWS SDK for Python

Added to portage

2025-12-30

botocore - 1.42.18
Ebuild name:

dev-python/botocore-1.42.18

Description

Low-level, data-driven core of boto 3

Added to portage

2025-12-30

fakefs - 3.2.0
Ebuild name:

dev-ruby/fakefs-3.2.0

Description

A fake filesystem. Use it in your tests

Added to portage

2025-12-30

faker - 40.1.0
Ebuild name:

dev-python/faker-40.1.0

Description

A Python package that generates fake data for you

Added to portage

2025-12-30

fiddle - 1.1.8
Ebuild name:

dev-ruby/fiddle-1.1.8

Description

A libffi wrapper for Ruby

Added to portage

2025-12-30

git - 4.0.7
Ebuild name:

dev-ruby/git-4.0.7

Description

Library for using Git in Ruby

Added to portage

2025-12-30

httparty - 0.24.0
Ebuild name:

dev-ruby/httparty-0.24.0

Description

Makes http fun Also, makes consuming restful web services dead easy

Added to portage

2025-12-30

kombu - 5.6.2
Ebuild name:

dev-python/kombu-5.6.2

Description

AMQP Messaging Framework for Python

Added to portage

2025-12-30

krita - 6.0.0_alpha_pre20251229
Ebuild name:

media-gfx/krita-6.0.0_alpha_pre20251229

Description

Free digital painting application. Digital Painting, Creati

Added to portage

2025-12-30

libcamera - 0.6.0
Ebuild name:

media-libs/libcamera-0.6.0

Description

Complex camera support library

Added to portage

2025-12-30

nomacs - 3.22.0
Ebuild name:

media-gfx/nomacs-3.22.0

Description

Qt-based image viewer

Added to portage

2025-12-30

omemo-dr - 1.2.0
Ebuild name:

dev-python/omemo-dr-1.2.0

Description

OMEMO Crypto Library

Added to portage

2025-12-30

parseedn - 1.2.1
Ebuild name:

app-emacs/parseedn-1.2.1

Description

EDN parser for Emacs Lisp

Added to portage

2025-12-30

portage-utils - 0.98
Ebuild name:

app-portage/portage-utils-0.98

Description

Small and fast Portage helper tools written in C

Added to portage

2025-12-30

pstore - 0.2.0
Ebuild name:

dev-ruby/pstore-0.2.0

Description

Transactional File Storage for Ruby Objects

Added to portage

2025-12-30

psutil - 7.2.1
Ebuild name:

dev-python/psutil-7.2.1

Description

Retrieve information on running processes and system utilization

Added to portage

2025-12-30

pygit2 - 1.19.1
Ebuild name:

dev-python/pygit2-1.19.1

Description

Python bindings for libgit2

Added to portage

2025-12-30

pylast - 7.0.1
Ebuild name:

dev-python/pylast-7.0.1

Description

Python interface to last.fm and other api-compatible websites

Added to portage

2025-12-30

qcheck - 0.27
Ebuild name:

dev-ml/qcheck-0.27

Description

QuickCheck inspired property-based testing for OCaml

Added to portage

2025-12-30

readline - 0.0.4
Ebuild name:

dev-ruby/readline-0.0.4

Description

Class to build custom data structures, similar to a Hash

Added to portage

2025-12-30

sabctools - 9.2.1
Ebuild name:

dev-python/sabctools-9.2.1

Description

Module providing raw yEnc encoding/decoding for SABnzbd

Added to portage

2025-12-30

termcolor - 3.3.0
Ebuild name:

dev-python/termcolor-3.3.0

Description

ANSI Color formatting for output in terminal

Added to portage

2025-12-30

uv - 0.9.20
Ebuild name:

dev-python/uv-0.9.20

Description

A Python package installer and resolver, written in Rust

Added to portage

2025-12-30

uv-build - 0.9.20
Ebuild name:

dev-python/uv-build-0.9.20

Description

PEP517 uv build backend

Added to portage

2025-12-30

xfce4-session - 4.21.1
Ebuild name:

xfce-base/xfce4-session-4.21.1

Description

A session manager for the Xfce desktop environment

Added to portage

2025-12-30

xfce4-settings - 4.20.3
Ebuild name:

xfce-base/xfce4-settings-4.20.3

Description

Configuration system for the Xfce desktop environment

Added to portage

2025-12-30

xpadneo - 0.9.8
Ebuild name:

games-util/xpadneo-0.9.8

Description

Advanced Linux Driver for Xbox One Wireless Controller

Added to portage

2025-12-30

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

darktable - 5.4.0
Ebuild name:

media-gfx/darktable-5.4.0

Description

A virtual lighttable and darkroom for photographers

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

gcc - 15.2.1_p20251227
Ebuild name:

sys-devel/gcc-15.2.1_p20251227

Description

The GNU Compiler Collection

Added to portage

2025-12-29

gcc - 16.0.0_p20251228
Ebuild name:

sys-devel/gcc-16.0.0_p20251228

Description

The GNU Compiler Collection

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

harfbuzz - 12.3.0
Ebuild name:

media-libs/harfbuzz-12.3.0

Description

An OpenType text shaping engine

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

kshutdown - 6.2
Ebuild name:

kde-misc/kshutdown-6.2

Description

Shutdown manager for desktop environments like KDE Plasma

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

libxfce4windowing - 4.20.5
Ebuild name:

xfce-base/libxfce4windowing-4.20.5

Description

Unified widget and session management libs for Xfce

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

messagelib - 25.08.3-r2
Ebuild name:

kde-apps/messagelib-25.08.3-r2

Description

Libraries for messaging functions

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

openresolv - 3.17.4
Ebuild name:

net-dns/openresolv-3.17.4

Description

A framework for managing DNS information

Added to portage

2025-12-29

plette - 2.1.0-r1
Ebuild name:

dev-python/plette-2.1.0-r1

Description

Structured Pipfile and Pipfile.lock models

Added to portage

2025-12-29

postfix - 3.11.0_rc2
Ebuild name:

mail-mta/postfix-3.11.0_rc2

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2025-12-29

postfix - 3.12_pre20251226
Ebuild name:

mail-mta/postfix-3.12_pre20251226

Description

A fast and secure drop-in replacement for sendmail

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

pycargoebuild - 0.15.1
Ebuild name:

app-portage/pycargoebuild-0.15.1

Description

A generator for Rust/Cargo ebuilds written in Python

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

tumbler - 4.21.1
Ebuild name:

xfce-base/tumbler-4.21.1

Description

A thumbnail service for Thunar

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

vulkan-loader - 1.4.335.0-r1
Ebuild name:

media-libs/vulkan-loader-1.4.335.0-r1

Description

Vulkan Installable Client Driver (ICD) Loader

Added to portage

2025-12-29

xfce4-panel - 4.20.6
Ebuild name:

xfce-base/xfce4-panel-4.20.6

Description

Panel for the Xfce desktop environment

Added to portage

2025-12-29

xfce4-power-manager - 4.21.1
Ebuild name:

xfce-base/xfce4-power-manager-4.21.1

Description

Power manager for the Xfce desktop environment

Added to portage

2025-12-29

xfce4-settings - 4.21.1
Ebuild name:

xfce-base/xfce4-settings-4.21.1

Description

Configuration system for the Xfce desktop environment

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

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