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:

82159

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-11-26
beep - 0
Ebuild name:

acct-group/beep-0

Description

Added to portage

2025-11-26

beep - 1.4.12-r3
Ebuild name:

app-misc/beep-1.4.12-r3

Description

Advanced PC speaker beeper

Added to portage

2025-11-26

denemo - 2.6.0-r102
Ebuild name:

media-sound/denemo-2.6.0-r102

Description

A music notation editor

Added to portage

2025-11-26

fuse - 1.6.0-r4
Ebuild name:

app-emulation/fuse-1.6.0-r4

Description

Free Unix Spectrum Emulator by Philip Kendall

Added to portage

2025-11-26

nuspell - 5.1.7
Ebuild name:

app-text/nuspell-5.1.7

Description

Spell checker library and CLI for complex natural languages

Added to portage

2025-11-26

pkg-info - 0.6
Ebuild name:

app-emacs/pkg-info-0.6

Description

Provide information about Emacs packages

Added to portage

2025-11-26

synapse - 1.143.0
Ebuild name:

net-im/synapse-1.143.0

Description

Reference implementation of Matrix homeserver

Added to portage

2025-11-26

2025-11-25
autobahn - 25.11.1
Ebuild name:

dev-python/autobahn-25.11.1

Description

WebSocket and WAMP for Twisted and Asyncio

Added to portage

2025-11-25

awscli - 1.43.3
Ebuild name:

app-admin/awscli-1.43.3

Description

Universal Command Line Environment for AWS

Added to portage

2025-11-25

bash - 5.4_alpha_pre20251124
Ebuild name:

app-shells/bash-5.4_alpha_pre20251124

Description

The standard GNU Bourne again shell

Added to portage

2025-11-25

bind - 9.18.42
Ebuild name:

net-dns/bind-9.18.42

Description

Berkeley Internet Name Domain - Name Server

Added to portage

2025-11-25

bind - 9.20.16
Ebuild name:

net-dns/bind-9.20.16

Description

Berkeley Internet Name Domain - Name Server

Added to portage

2025-11-25

boto3 - 1.41.3
Ebuild name:

dev-python/boto3-1.41.3

Description

The AWS SDK for Python

Added to portage

2025-11-25

botocore - 1.41.3
Ebuild name:

dev-python/botocore-1.41.3

Description

Low-level, data-driven core of boto 3

Added to portage

2025-11-25

cargo-nextest - 0.9.114
Ebuild name:

dev-util/cargo-nextest-0.9.114

Description

Next-generation test runner for Rust

Added to portage

2025-11-25

dbmail - 3.5.5
Ebuild name:

net-mail/dbmail-3.5.5

Description

Fast and scalable sql based email services

Added to portage

2025-11-25

discord - 0.0.116
Ebuild name:

net-im/discord-0.0.116

Description

All-in-one voice and text chat for gamers

Added to portage

2025-11-25

discord - 0.0.116-r1
Ebuild name:

net-im/discord-0.0.116-r1

Description

All-in-one voice and text chat for gamers

Added to portage

2025-11-25

dist-kernel - 6.12.59
Ebuild name:

virtual/dist-kernel-6.12.59

Description

Virtual to depend on any Distribution Kernel

Added to portage

2025-11-25

dist-kernel - 6.17.9
Ebuild name:

virtual/dist-kernel-6.17.9

Description

Virtual to depend on any Distribution Kernel

Added to portage

2025-11-25

dist-kernel - 6.6.117
Ebuild name:

virtual/dist-kernel-6.6.117

Description

Virtual to depend on any Distribution Kernel

Added to portage

2025-11-25

firefox-bin - 145.0.2
Ebuild name:

www-client/firefox-bin-145.0.2

Description

Firefox Web Browser

Added to portage

2025-11-25

fscrypt - 0.3.6
Ebuild name:

sys-fs/fscrypt-0.3.6

Description

Tool for managing Linux filesystem encryption

Added to portage

2025-11-25

gentoo-kernel - 6.12.59
Ebuild name:

sys-kernel/gentoo-kernel-6.12.59

Description

Linux kernel built with Gentoo patches

Added to portage

2025-11-25

gentoo-kernel - 6.17.9
Ebuild name:

sys-kernel/gentoo-kernel-6.17.9

Description

Linux kernel built with Gentoo patches

Added to portage

2025-11-25

gentoo-kernel - 6.6.117
Ebuild name:

sys-kernel/gentoo-kernel-6.6.117

Description

Linux kernel built with Gentoo patches

Added to portage

2025-11-25

gentoo-kernel-bin - 6.12.59
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.12.59

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2025-11-25

gentoo-kernel-bin - 6.17.9
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.17.9

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2025-11-25

gentoo-kernel-bin - 6.6.117
Ebuild name:

sys-kernel/gentoo-kernel-bin-6.6.117

Description

Pre-built Linux kernel with Gentoo patches

Added to portage

2025-11-25

gentoo-sources - 6.12.59
Ebuild name:

sys-kernel/gentoo-sources-6.12.59

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2025-11-25

gentoo-sources - 6.17.9
Ebuild name:

sys-kernel/gentoo-sources-6.17.9

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2025-11-25

gentoo-sources - 6.6.117
Ebuild name:

sys-kernel/gentoo-sources-6.6.117

Description

Full sources including the Gentoo patchset for the . kernel tree

Added to portage

2025-11-25

gtk - 4.20.3-r1
Ebuild name:

gui-libs/gtk-4.20.3-r1

Description

GTK is a multi-platform toolkit for creating graphical user interfaces

Added to portage

2025-11-25

httpd-php - 8.5
Ebuild name:

virtual/httpd-php-8.5

Description

Virtual to provide PHP-enabled webservers

Added to portage

2025-11-25

ktextaddons - 1.8.0
Ebuild name:

dev-libs/ktextaddons-1.8.0

Description

Various text handling addons

Added to portage

2025-11-25

libhx - 5.2
Ebuild name:

sys-libs/libhx-5.2

Description

Platform independent library providing basic system functions

Added to portage

2025-11-25

mitmproxy - 12.2.1
Ebuild name:

net-proxy/mitmproxy-12.2.1

Description

An interactive, SSL-capable, man-in-the-middle HTTP proxy

Added to portage

2025-11-25

mitmproxy-linux - 0.12.8
Ebuild name:

net-proxy/mitmproxy-linux-0.12.8

Description

mitmproxy's Rust bits

Added to portage

2025-11-25

mitmproxy-rs - 0.12.8
Ebuild name:

net-proxy/mitmproxy-rs-0.12.8

Description

mitmproxy's Rust bits

Added to portage

2025-11-25

mlt - 7.34.1-r1
Ebuild name:

media-libs/mlt-7.34.1-r1

Description

Open source multimedia framework for television broadcasting

Added to portage

2025-11-25

mpvqt - 1.1.1-r1
Ebuild name:

media-libs/mpvqt-1.1.1-r1

Description

libmpv wrapper for QtQuick2 and QML

Added to portage

2025-11-25

msgspec - 0.20.0
Ebuild name:

dev-python/msgspec-0.20.0

Description

Fast serialization and validation library, with builtin support for many

Added to portage

2025-11-25

networkx - 3.6
Ebuild name:

dev-python/networkx-3.6

Description

Python tools to manipulate graphs and complex networks

Added to portage

2025-11-25

nextcloud - 32.0.2
Ebuild name:

www-apps/nextcloud-32.0.2

Description

Personal cloud that runs on your own server

Added to portage

2025-11-25

nghttp3 - 1.13.1
Ebuild name:

net-libs/nghttp3-1.13.1

Description

HTTP/3 library written in C

Added to portage

2025-11-25

ngtcp2 - 1.18.0
Ebuild name:

net-libs/ngtcp2-1.18.0

Description

Implementation of the IETF QUIC Protocol

Added to portage

2025-11-25

openhab-bin - 5.0.3
Ebuild name:

app-misc/openhab-bin-5.0.3

Description

An open-source automation software for your home

Added to portage

2025-11-25

pax-utils - 1.3.10
Ebuild name:

app-misc/pax-utils-1.3.10

Description

ELF utils that can check files for security relevant properties

Added to portage

2025-11-25

pcsc-lite - 2.4.0
Ebuild name:

sys-apps/pcsc-lite-2.4.0

Description

PC/SC Architecture smartcard middleware library

Added to portage

2025-11-25

pdm - 2.26.2
Ebuild name:

dev-python/pdm-2.26.2

Description

Python package and dependency manager supporting the latest PEP standards

Added to portage

2025-11-25

php - 8.5.0
Ebuild name:

dev-lang/php-8.5.0

Description

The PHP language runtime engine

Added to portage

2025-11-25

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-11-25

postfix - 3.11_pre20251124
Ebuild name:

mail-mta/postfix-3.11_pre20251124

Description

A fast and secure drop-in replacement for sendmail

Added to portage

2025-11-25

pytest-localserver - 0.10.0
Ebuild name:

dev-python/pytest-localserver-0.10.0

Description

Pytest plugin to test server connections locally

Added to portage

2025-11-25

qtcurve - 1.9.0_p20250314-r2
Ebuild name:

x11-themes/qtcurve-1.9.0_p20250314-r2

Description

Widget styles for Qt and GTK2

Added to portage

2025-11-25

s3fs - 1.96
Ebuild name:

net-fs/s3fs-1.96

Description

Amazon S3 mounting via fuse

Added to portage

2025-11-25

spotify - 1.2.74-r1
Ebuild name:

media-sound/spotify-1.2.74-r1

Description

Spotify is a social music platform

Added to portage

2025-11-25

task - 3.4.2
Ebuild name:

app-misc/task-3.4.2

Description

Command-line todo list manager

Added to portage

2025-11-25

textx - 4.3.0
Ebuild name:

dev-python/textx-4.3.0

Description

Meta-language for DSL implementation inspired by Xtext

Added to portage

2025-11-25

tree-sitter-haskell - 0.23.1
Ebuild name:

dev-libs/tree-sitter-haskell-0.23.1

Description

Haskell grammar for Tree-sitter

Added to portage

2025-11-25

tree-sitter-julia - 0.25.0
Ebuild name:

dev-libs/tree-sitter-julia-0.25.0

Description

Julia grammar for Tree-sitter

Added to portage

2025-11-25

trimesh - 4.10.0
Ebuild name:

dev-python/trimesh-4.10.0

Description

Python library for loading and using triangular meshes

Added to portage

2025-11-25

types-psutil - 7.1.3.20251125
Ebuild name:

dev-python/types-psutil-7.1.3.20251125

Description

Typing stubs for psutil

Added to portage

2025-11-25

udisks - 2.11.0
Ebuild name:

sys-fs/udisks-2.11.0

Description

Daemon providing interfaces to work with storage devices

Added to portage

2025-11-25

upterm - 0.19.0
Ebuild name:

app-misc/upterm-0.19.0

Description

Instant Terminal Sharing

Added to portage

2025-11-25

userspace-rcu - 0.15.5
Ebuild name:

dev-libs/userspace-rcu-0.15.5

Description

Userspace RCU (read-copy-update) library

Added to portage

2025-11-25

vanilla-kernel - 6.12.59
Ebuild name:

sys-kernel/vanilla-kernel-6.12.59

Description

Linux kernel built from vanilla upstream sources

Added to portage

2025-11-25

vanilla-kernel - 6.17.9
Ebuild name:

sys-kernel/vanilla-kernel-6.17.9

Description

Linux kernel built from vanilla upstream sources

Added to portage

2025-11-25

vanilla-kernel - 6.6.117
Ebuild name:

sys-kernel/vanilla-kernel-6.6.117

Description

Linux kernel built from vanilla upstream sources

Added to portage

2025-11-25

vanilla-sources - 6.12.59
Ebuild name:

sys-kernel/vanilla-sources-6.12.59

Description

Full sources for the Linux kernel

Added to portage

2025-11-25

vanilla-sources - 6.17.9
Ebuild name:

sys-kernel/vanilla-sources-6.17.9

Description

Full sources for the Linux kernel

Added to portage

2025-11-25

vanilla-sources - 6.6.117
Ebuild name:

sys-kernel/vanilla-sources-6.6.117

Description

Full sources for the Linux kernel

Added to portage

2025-11-25

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