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:

56192

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: 2.5 (2 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
2020-08-11
Pod-Parser - 1.630.0-r1
Ebuild name:

dev-perl/Pod-Parser-1.630.0-r1

Description

POD filters and translators

Added to portage

2020-08-11

angband - 4.2.1-r1
Ebuild name:

games-roguelike/angband-4.2.1-r1

Description

A roguelike dungeon exploration game based on the books of J.R.R.

Added to portage

2020-08-11

appmenu-gtk-module - 0.7.3-r1
Ebuild name:

x11-misc/appmenu-gtk-module-0.7.3-r1

Description

Application menu module for GTK

Added to portage

2020-08-11

coin - 4.0.0
Ebuild name:

media-libs/coin-4.0.0

Description

A high-level 3D graphics toolkit, fully compatible with SGI Open Inventor 2.1

Added to portage

2020-08-11

darktable - 3.2.1
Ebuild name:

media-gfx/darktable-3.2.1

Description

A virtual lighttable and darkroom for photographers

Added to portage

2020-08-11

imagemagick - 6.9.11.26
Ebuild name:

media-gfx/imagemagick-6.9.11.26

Description

A collection of tools and libraries for many image formats

Added to portage

2020-08-11

links - 2.21
Ebuild name:

www-client/links-2.21

Description

A fast and lightweight web browser running in both graphics and text mode

Added to portage

2020-08-11

quex - 0.71.0
Ebuild name:

dev-python/quex-0.71.0

Description

Mode Oriented Directly Coded Lexical Analyser Generator

Added to portage

2020-08-11

2020-08-10
Pod-Abstract - 0.200.0-r2
Ebuild name:

dev-perl/Pod-Abstract-0.200.0-r2

Description

Abstract document tree for Perl POD documents

Added to portage

2020-08-10

audio_capture - 0.3.7
Ebuild name:

dev-ros/audio_capture-0.3.7

Description

Transports audio from a source to a destination

Added to portage

2020-08-10

audio_common - 0.3.7
Ebuild name:

ros-meta/audio_common-0.3.7

Description

Common code for working with audio in ROS

Added to portage

2020-08-10

audio_common_msgs - 0.3.7
Ebuild name:

dev-ros/audio_common_msgs-0.3.7

Description

Messages for transmitting audio via ROS

Added to portage

2020-08-10

audio_play - 0.3.7
Ebuild name:

dev-ros/audio_play-0.3.7

Description

Outputs audio to a speaker from a source node

Added to portage

2020-08-10

bash - 4.4_p23-r2
Ebuild name:

app-shells/bash-4.4_p23-r2

Description

The standard GNU Bourne again shell

Added to portage

2020-08-10

catkin - 0.8.8-r1
Ebuild name:

dev-util/catkin-0.8.8-r1

Description

Cmake macros and associated python code used to build some parts of ROS

Added to portage

2020-08-10

cryptodev - 1.11
Ebuild name:

sys-kernel/cryptodev-1.11

Description

device that allows access to Linux kernel cryptographic drivers

Added to portage

2020-08-10

dmalloc - 999999
Ebuild name:

dev-libs/dmalloc-999999

Description

A Debug Malloc Library

Added to portage

2020-08-10

eduke32 - 20200808.9208
Ebuild name:

games-fps/eduke32-20200808.9208

Description

An open source engine port of the classic PC first person shooter D

Added to portage

2020-08-10

exo - 1.16.0
Ebuild name:

app-admin/exo-1.16.0

Description

Command-line tool for everything at Exoscale compute, storage, dns.

Added to portage

2020-08-10

genkernel - 4.1.0
Ebuild name:

sys-kernel/genkernel-4.1.0

Description

Gentoo automatic kernel building scripts

Added to portage

2020-08-10

google-auth - 1.14.3-r2
Ebuild name:

dev-python/google-auth-1.14.3-r2

Description

Google Authentication Library

Added to portage

2020-08-10

google-auth - 1.20.1
Ebuild name:

dev-python/google-auth-1.20.1

Description

Google Authentication Library

Added to portage

2020-08-10

google-auth-httplib2 - 0.0.4
Ebuild name:

dev-python/google-auth-httplib2-0.0.4

Description

httplib2 Transport for Google Auth

Added to portage

2020-08-10

hypothesis - 5.23.12
Ebuild name:

dev-python/hypothesis-5.23.12

Description

A library for property based testing

Added to portage

2020-08-10

ibus-typing-booster - 2.9.5
Ebuild name:

app-i18n/ibus-typing-booster-2.9.5

Description

Completion input method for IBus

Added to portage

2020-08-10

kodi-pvr-iptvsimple - 6.3.0
Ebuild name:

media-plugins/kodi-pvr-iptvsimple-6.3.0

Description

Kodi's IPTVSimple client addon

Added to portage

2020-08-10

kodi-pvr-wmc - 5.0.2
Ebuild name:

media-plugins/kodi-pvr-wmc-5.0.2

Description

Kodi's Windows Media Center client addon

Added to portage

2020-08-10

leatherman - 1.12.1-r1
Ebuild name:

dev-libs/leatherman-1.12.1-r1

Description

A C++ toolkit

Added to portage

2020-08-10

lvm2 - 2.03.10
Ebuild name:

sys-fs/lvm2-2.03.10

Description

User-land utilities for LVM2 (device-mapper) software

Added to portage

2020-08-10

mod_h2 - 1.15.14
Ebuild name:

www-apache/mod_h2-1.15.14

Description

HTTP/2 module for Apache

Added to portage

2020-08-10

nagios-plugins-linux-madrisan - 27
Ebuild name:

net-analyzer/nagios-plugins-linux-madrisan-27

Description

Additional and alternative Nagios plugins for Linux

Added to portage

2020-08-10

netdata - 1.24.0
Ebuild name:

net-analyzer/netdata-1.24.0

Description

Linux real time system monitoring, done right

Added to portage

2020-08-10

numlockx - 1.2
Ebuild name:

x11-misc/numlockx-1.2

Description

Turns on numlock in X

Added to portage

2020-08-10

obconf - 2.0.4
Ebuild name:

x11-misc/obconf-2.0.4

Description

ObConf is a tool for configuring the Openbox window manager

Added to portage

2020-08-10

obconf - 9999
Ebuild name:

x11-misc/obconf-9999

Description

ObConf is a tool for configuring the Openbox window manager

Added to portage

2020-08-10

obconf-qt - 0.14.1
Ebuild name:

x11-misc/obconf-qt-0.14.1

Description

Openbox window manager configuration tool

Added to portage

2020-08-10

obconf-qt - 0.15.0
Ebuild name:

x11-misc/obconf-qt-0.15.0

Description

Qt GUI Openbox Configuration Tool

Added to portage

2020-08-10

obmenu-generator - 0.88
Ebuild name:

x11-misc/obmenu-generator-0.88

Description

A fast pipe/static menu generator for the Openbox Window Manager

Added to portage

2020-08-10

openbox-menu - 0.8.0
Ebuild name:

x11-misc/openbox-menu-0.8.0

Description

Another dynamic menu generator for Openbox

Added to portage

2020-08-10

oroborus-deskmenu - 1.4.5-r1
Ebuild name:

x11-misc/oroborus-deskmenu-1.4.5-r1

Description

root menu program for Oroborus

Added to portage

2020-08-10

oroborus-keylaunch - 1.3.9-r1
Ebuild name:

x11-misc/oroborus-keylaunch-1.3.9-r1

Description

utility for binding keys in Oroborus

Added to portage

2020-08-10

otter - 1.0.01-r1
Ebuild name:

www-client/otter-1.0.01-r1

Description

Project aiming to recreate classic Opera (12.x) UI using Qt5

Added to portage

2020-08-10

parcellite - 1.2.1
Ebuild name:

x11-misc/parcellite-1.2.1

Description

A lightweight GTK+ based clipboard manager

Added to portage

2020-08-10

pcmanfm - 1.3.1
Ebuild name:

x11-misc/pcmanfm-1.3.1

Description

Fast lightweight tabbed filemanager

Added to portage

2020-08-10

pcmanfm - 9999
Ebuild name:

x11-misc/pcmanfm-9999

Description

Fast lightweight tabbed filemanager

Added to portage

2020-08-10

po4a - 0.61
Ebuild name:

app-text/po4a-0.61

Description

Tools to ease the translation of documentation

Added to portage

2020-08-10

python-stdnum - 1.14
Ebuild name:

dev-python/python-stdnum-1.14

Description

A module to handle standardized numbers and codes

Added to portage

2020-08-10

quex - 0.70.0
Ebuild name:

dev-python/quex-0.70.0

Description

Mode Oriented Directly Coded Lexical Analyser Generator

Added to portage

2020-08-10

rbst - 0.6.5
Ebuild name:

dev-ruby/rbst-0.6.5

Description

A simple Ruby wrapper for processing rST via docutils

Added to portage

2020-08-10

rdiscount - 2.2.0.2
Ebuild name:

dev-ruby/rdiscount-2.2.0.2

Description

Implementation of John Gruber's Markdown

Added to portage

2020-08-10

rosbag_storage - 1.15.8-r1
Ebuild name:

dev-ros/rosbag_storage-1.15.8-r1

Description

Set of tools for recording from and playing back ROS message

Added to portage

2020-08-10

setuptools - 49.3.0
Ebuild name:

dev-python/setuptools-49.3.0

Description

Collection of extensions to Distutils

Added to portage

2020-08-10

sphinxcontrib-websupport - 1.2.4
Ebuild name:

dev-python/sphinxcontrib-websupport-1.2.4

Description

Sphinx websupport extension

Added to portage

2020-08-10

statifier - 1.7.4-r1
Ebuild name:

dev-util/statifier-1.7.4-r1

Description

Statifier is a tool for creating portable, self-containing Linux execut

Added to portage

2020-08-10

sudo - 1.8.31_p2
Ebuild name:

app-admin/sudo-1.8.31_p2

Description

Allows users or groups to run commands as other users

Added to portage

2020-08-10

tty-color - 0.5.2
Ebuild name:

dev-ruby/tty-color-0.5.2

Description

Terminal color capabilities detection

Added to portage

2020-08-10

urwid - 2.1.1
Ebuild name:

dev-python/urwid-2.1.1

Description

Curses-based user interface library for Python

Added to portage

2020-08-10

ydiff - 1.2
Ebuild name:

dev-util/ydiff-1.2

Description

Colored, side-by-side diff terminal viewer (ex. cdiff)

Added to portage

2020-08-10

zen-sources - 5.7.12
Ebuild name:

sys-kernel/zen-sources-5.7.12

Description

The Zen Kernel Live Sources

Added to portage

2020-08-10

zpaq-extras - 3
Ebuild name:

app-arch/zpaq-extras-3

Description

A set of additional compression profiles for app-arch/zpaq

Added to portage

2020-08-10

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