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:

62674

userrating:

average rating: 1.5 (4 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.8 (4 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
2023-01-27
ada_language_server - 23.0.10-r1
Ebuild name:

dev-ada/ada_language_server-23.0.10-r1

Description

an implementation of the Microsoft Language Server Protocol

Added to portage

2023-01-27

bpftrace - 0.16.0-r2
Ebuild name:

dev-util/bpftrace-0.16.0-r2

Description

High-level tracing language for eBPF

Added to portage

2023-01-27

difftastic - 0.42.0
Ebuild name:

dev-util/difftastic-0.42.0

Description

A structural diff that understands syntax.

Added to portage

2023-01-27

fswatch - 1.17.1
Ebuild name:

sys-fs/fswatch-1.17.1

Description

cross-platform file change monitor with multiple backends

Added to portage

2023-01-27

gitea - 1.18.3
Ebuild name:

www-apps/gitea-1.18.3

Description

A painless self-hosted Git service

Added to portage

2023-01-27

libfido2 - 1.12.0
Ebuild name:

dev-libs/libfido2-1.12.0

Description

Provides library functionality for FIDO 2.0

Added to portage

2023-01-27

libpaper - 2.0.5
Ebuild name:

app-text/libpaper-2.0.5

Description

Library for handling paper characteristics

Added to portage

2023-01-27

libtmux - 0.20.0
Ebuild name:

dev-python/libtmux-0.20.0

Description

Python API for tmux

Added to portage

2023-01-27

libvirt - 8.9.0-r1
Ebuild name:

app-emulation/libvirt-8.9.0-r1

Description

C toolkit to manipulate virtual machines

Added to portage

2023-01-27

ndctl - 75
Ebuild name:

sys-block/ndctl-75

Description

Helper tools and libraries for managing non-volatile memory on Linux

Added to portage

2023-01-27

pax-utils - 1.3.7
Ebuild name:

app-misc/pax-utils-1.3.7

Description

ELF utils that can check files for security relevant properties

Added to portage

2023-01-27

pipewire - 0.3.65
Ebuild name:

media-video/pipewire-0.3.65

Description

Multimedia processing graphs

Added to portage

2023-01-27

qtgui - 5.15.8-r2
Ebuild name:

dev-qt/qtgui-5.15.8-r2

Description

The GUI module and platform plugins for the Qt5 framework

Added to portage

2023-01-27

qtimageformats - 5.15.8-r1
Ebuild name:

dev-qt/qtimageformats-5.15.8-r1

Description

Additional format plugins for the Qt image I/O system

Added to portage

2023-01-27

qtwidgets - 5.15.8-r1
Ebuild name:

dev-qt/qtwidgets-5.15.8-r1

Description

Set of components for creating classic desktop-style UIs for the Qt5 fra

Added to portage

2023-01-27

rocksdb - 7.9.2
Ebuild name:

dev-libs/rocksdb-7.9.2

Description

Embeddable, persistent key-value store for fast storage

Added to portage

2023-01-27

rt-sources - 5.10.162_p79
Ebuild name:

sys-kernel/rt-sources-5.10.162_p79

Description

Full Linux . kernel sources with the CONFIG_PREEMPT_RT patch

Added to portage

2023-01-27

simdjson - 3.1.0
Ebuild name:

dev-libs/simdjson-3.1.0

Description

SIMD accelerated C++ JSON library

Added to portage

2023-01-27

suil - 0.10.18-r1
Ebuild name:

media-libs/suil-0.10.18-r1

Description

Lightweight C library for loading and wrapping LV2 plugin UIs

Added to portage

2023-01-27

supertuxkart - 1.4
Ebuild name:

games-action/supertuxkart-1.4

Description

A kart racing game starring Tux, the linux penguin (TuxKart fork)

Added to portage

2023-01-27

texinfo - 9999
Ebuild name:

sys-apps/texinfo-9999

Description

The GNU info program and utilities

Added to portage

2023-01-27

tmuxp - 1.26.0
Ebuild name:

app-misc/tmuxp-1.26.0

Description

tmux session manager. built on libtmux

Added to portage

2023-01-27

wesnoth - 1.16.8
Ebuild name:

games-strategy/wesnoth-1.16.8

Description

Battle for Wesnoth - A fantasy turn-based strategy game

Added to portage

2023-01-27

2023-01-26
IO-Socket-SSL - 2.81.0
Ebuild name:

dev-perl/IO-Socket-SSL-2.81.0

Description

Nearly transparent SSL encapsulation for IO

Added to portage

2023-01-26

apache - 2.4.55
Ebuild name:

www-servers/apache-2.4.55

Description

The Apache Web Server

Added to portage

2023-01-26

apache-tools - 2.4.55
Ebuild name:

app-admin/apache-tools-2.4.55

Description

Useful Apache tools - htdigest, htpasswd, ab, htdbm

Added to portage

2023-01-26

awscli - 1.27.57
Ebuild name:

app-admin/awscli-1.27.57

Description

Universal Command Line Environment for AWS

Added to portage

2023-01-26

bandit - 1.7.4-r1
Ebuild name:

dev-python/bandit-1.7.4-r1

Description

A security linter from OpenStack Security

Added to portage

2023-01-26

boto3 - 1.26.57
Ebuild name:

dev-python/boto3-1.26.57

Description

The AWS SDK for Python

Added to portage

2023-01-26

botocore - 1.29.57
Ebuild name:

dev-python/botocore-1.29.57

Description

Low-level, data-driven core of boto 3

Added to portage

2023-01-26

braintree - 4.18.1
Ebuild name:

dev-python/braintree-4.18.1

Description

Braintree Python Library

Added to portage

2023-01-26

brltty - 6.5-r1
Ebuild name:

app-accessibility/brltty-6.5-r1

Description

Daemon that provides access to the Linux/Unix console for a blind p

Added to portage

2023-01-26

btrfs-progs - 6.1.3
Ebuild name:

sys-fs/btrfs-progs-6.1.3

Description

Btrfs filesystem utilities

Added to portage

2023-01-26

cargo-tarpaulin - 0.24.0
Ebuild name:

dev-util/cargo-tarpaulin-0.24.0

Description

Cargo-Tarpaulin is a tool to determine code coverage achieved via t

Added to portage

2023-01-26

ceph - 16.2.11
Ebuild name:

sys-cluster/ceph-16.2.11

Description

Ceph distributed filesystem

Added to portage

2023-01-26

exiv2 - 0.27.6
Ebuild name:

media-gfx/exiv2-0.27.6

Description

EXIF, IPTC and XMP metadata C++ library and command line utility

Added to portage

2023-01-26

gdb - 12.1-r4
Ebuild name:

sys-devel/gdb-12.1-r4

Description

GNU debugger

Added to portage

2023-01-26

gdb - 13.0.90_p20230126
Ebuild name:

sys-devel/gdb-13.0.90_p20230126

Description

GNU debugger

Added to portage

2023-01-26

geant4_vmc - 6.1_p3
Ebuild name:

sci-physics/geant4_vmc-6.1_p3

Description

Virtual Monte Carlo Geant4 implementation

Added to portage

2023-01-26

geant4_vmc - 6.2
Ebuild name:

sci-physics/geant4_vmc-6.2

Description

Virtual Monte Carlo Geant4 implementation

Added to portage

2023-01-26

geiser - 0.28.1
Ebuild name:

app-emacs/geiser-0.28.1

Description

Generic interaction mode between Emacs and different Scheme implementations

Added to portage

2023-01-26

gi-docgen - 2023.1-r1
Ebuild name:

dev-util/gi-docgen-2023.1-r1

Description

A documentation generator for GObject-based libraries

Added to portage

2023-01-26

globalid - 1.1.0
Ebuild name:

dev-ruby/globalid-1.1.0

Description

Reference models by URI

Added to portage

2023-01-26

golangci-lint - 1.50.1-r1
Ebuild name:

dev-go/golangci-lint-1.50.1-r1

Description

Fast linters runner for Go

Added to portage

2023-01-26

gwenview - 22.08.3-r2
Ebuild name:

kde-apps/gwenview-22.08.3-r2

Description

Image viewer by KDE

Added to portage

2023-01-26

gwenview - 22.12.1-r1
Ebuild name:

kde-apps/gwenview-22.12.1-r1

Description

Image viewer by KDE

Added to portage

2023-01-26

haproxy - 2.5.11
Ebuild name:

net-proxy/haproxy-2.5.11

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2023-01-26

haproxy - 2.6.8
Ebuild name:

net-proxy/haproxy-2.6.8

Description

A TCP/HTTP reverse proxy for high availability environments

Added to portage

2023-01-26

ldns - 1.8.3
Ebuild name:

net-libs/ldns-1.8.3

Description

A library with the aim to simplify DNS programming in C

Added to portage

2023-01-26

myspell-hu - 7.1.3.2
Ebuild name:

app-dicts/myspell-hu-7.1.3.2

Description

Hungarian dictionaries for myspell/hunspell

Added to portage

2023-01-26

myspell-ia - 20140518
Ebuild name:

app-dicts/myspell-ia-20140518

Description

Interlingua dictionaries for myspell/hunspell

Added to portage

2023-01-26

myspell-id - 2.0
Ebuild name:

app-dicts/myspell-id-2.0

Description

Indonesian dictionaries for myspell/hunspell

Added to portage

2023-01-26

networkmanager - 1.40.12
Ebuild name:

net-misc/networkmanager-1.40.12

Description

A set of co-operative tools that make networking simple and straigh

Added to portage

2023-01-26

newsboat - 2.30.1
Ebuild name:

net-news/newsboat-2.30.1

Description

An RSS/Atom feed reader for text terminals

Added to portage

2023-01-26

oidc-agent - 4.5.0
Ebuild name:

net-misc/oidc-agent-4.5.0

Description

Agent and tools for managing OpenID Connect tokens on the command line

Added to portage

2023-01-26

pari - 2.15.2-r2
Ebuild name:

sci-mathematics/pari-2.15.2-r2

Description

Computer-aided number theory C library and tools

Added to portage

2023-01-26

passenger - 6.0.17
Ebuild name:

www-apache/passenger-6.0.17

Description

Passenger makes deployment of Ruby on Rails applications a breeze

Added to portage

2023-01-26

pcsx2 - 1.7.3958
Ebuild name:

games-emulation/pcsx2-1.7.3958

Description

PlayStation 2 emulator

Added to portage

2023-01-26

pikepdf - 6.2.9
Ebuild name:

dev-python/pikepdf-6.2.9

Description

Python library to work with pdf files based on qpdf

Added to portage

2023-01-26

pipewire - 0.3.64-r2
Ebuild name:

media-video/pipewire-0.3.64-r2

Description

Multimedia processing graphs

Added to portage

2023-01-26

podman-py - 4.3.0-r1
Ebuild name:

dev-python/podman-py-4.3.0-r1

Description

A library to interact with a Podman server

Added to portage

2023-01-26

poke - 3.0
Ebuild name:

dev-util/poke-3.0

Description

Extensible editor for structured binary data

Added to portage

2023-01-26

pylama - 8.4.1-r1
Ebuild name:

dev-python/pylama-8.4.1-r1

Description

Code audit tool for python

Added to portage

2023-01-26

python-lsp-black - 1.2.1-r1
Ebuild name:

dev-python/python-lsp-black-1.2.1-r1

Description

Black plugin for the Python LSP Server

Added to portage

2023-01-26

qtractor - 0.9.31
Ebuild name:

media-sound/qtractor-0.9.31

Description

Audio/MIDI multi-track sequencer written in C++ with the Qt framework

Added to portage

2023-01-26

ruffle - 0_p20230125
Ebuild name:

app-emulation/ruffle-0_p20230125

Description

Flash Player emulator written in Rust

Added to portage

2023-01-26

sip - 6.7.5-r1
Ebuild name:

dev-python/sip-6.7.5-r1

Description

Python bindings generator for C/C++ libraries

Added to portage

2023-01-26

tcl - 8.6.13-r1
Ebuild name:

dev-lang/tcl-8.6.13-r1

Description

Tool Command Language

Added to portage

2023-01-26

tox - 4.4.2
Ebuild name:

dev-python/tox-4.4.2

Description

virtualenv-based automation of test activities

Added to portage

2023-01-26

vgm - 5.1
Ebuild name:

sci-physics/vgm-5.1

Description

Virtual Geometry Model for High Energy Physics Experiments

Added to portage

2023-01-26

xine-lib - 1.2.13
Ebuild name:

media-libs/xine-lib-1.2.13

Description

Core libraries for Xine movie player

Added to portage

2023-01-26

yapf - 0.32.0-r1
Ebuild name:

dev-python/yapf-0.32.0-r1

Description

A formatter for Python files

Added to portage

2023-01-26

yq - 3.1.0-r1
Ebuild name:

app-misc/yq-3.1.0-r1

Description

Command-line YAML processor - jq wrapper for YAML documents

Added to portage

2023-01-26

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