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:

44395

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



Other free services
toURL.org
Shorten long
URLs to short
links like
http://tourl.org/2
tourl.org
.
Reverse DNS lookup
Find out which hostname(s)
resolve to a
given IP or other hostnames for the server
www.reversednslookup.org

New Packages

- as rdf newsfeed
- as rss newsfeed
- as Atom newsfeed
2019-01-21
appstream - 0.12.4
Ebuild name:

dev-libs/appstream-0.12.4

Description

Cross-distro effort for providing metadata for software in the Linux ecos

Added to portage

2019-01-21

freezegun - 0.3.11
Ebuild name:

dev-python/freezegun-0.3.11

Description

Let your Python tests travel through time

Added to portage

2019-01-21

kconfig - 5.54.0-r1
Ebuild name:

kde-frameworks/kconfig-5.54.0-r1

Description

Framework for reading and writing configuration

Added to portage

2019-01-21

libreoffice-l10n - 6.1.5.1
Ebuild name:

app-office/libreoffice-l10n-6.1.5.1

Description

Translations for the Libreoffice suite

Added to portage

2019-01-21

mysql-cluster - 7.2.34
Ebuild name:

dev-db/mysql-cluster-7.2.34

Description

An enhanced, drop-in replacement for MySQL

Added to portage

2019-01-21

mysql-cluster - 7.3.22
Ebuild name:

dev-db/mysql-cluster-7.3.22

Description

An enhanced, drop-in replacement for MySQL

Added to portage

2019-01-21

mysql-cluster - 7.4.21
Ebuild name:

dev-db/mysql-cluster-7.4.21

Description

An enhanced, drop-in replacement for MySQL

Added to portage

2019-01-21

mysqlclient - 1.4.1
Ebuild name:

dev-python/mysqlclient-1.4.1

Description

Fork of MySQL-python

Added to portage

2019-01-21

photoqt - 1.7.1-r1
Ebuild name:

media-gfx/photoqt-1.7.1-r1

Description

Simple but powerful Qt-based image viewer

Added to portage

2019-01-21

portage - 2.3.57
Ebuild name:

sys-apps/portage-2.3.57

Description

Portage is the package management and distribution system for Gentoo

Added to portage

2019-01-21

tor - 0.4.0.1_alpha
Ebuild name:

net-vpn/tor-0.4.0.1_alpha

Description

Anonymizing overlay network for TCP

Added to portage

2019-01-21

tox - 3.7.0
Ebuild name:

dev-python/tox-3.7.0

Description

virtualenv-based automation of test activities

Added to portage

2019-01-21

wrk - 4.1.0-r1
Ebuild name:

app-benchmarks/wrk-4.1.0-r1

Description

A HTTP benchmarking tool

Added to portage

2019-01-21

2019-01-20
aiohttp-socks - 0.2.2
Ebuild name:

dev-python/aiohttp-socks-0.2.2

Description

SOCKS proxy connector for aiohttp

Added to portage

2019-01-20

aiorpcX - 0.10.2
Ebuild name:

dev-python/aiorpcX-0.10.2

Description

Generic async RPC implementation, including JSON-RPC

Added to portage

2019-01-20

alacritty - 0.2.6
Ebuild name:

x11-terms/alacritty-0.2.6

Description

GPU-accelerated terminal emulator

Added to portage

2019-01-20

arduino-builder - 1.4.1-r1
Ebuild name:

dev-embedded/arduino-builder-1.4.1-r1

Description

A command line tool for compiling Arduino sketches

Added to portage

2019-01-20

conky - 1.10.8-r5
Ebuild name:

app-admin/conky-1.10.8-r5

Description

An advanced, highly configurable system monitor for X

Added to portage

2019-01-20

cool-retro-term - 1.1.1
Ebuild name:

x11-terms/cool-retro-term-1.1.1

Description

terminal emulator which mimics the look and feel of the old cathode

Added to portage

2019-01-20

cri - 2.15.3
Ebuild name:

dev-ruby/cri-2.15.3

Description

Cri is a library for building easy-to-use commandline tools

Added to portage

2019-01-20

cython - 0.29.3
Ebuild name:

dev-python/cython-0.29.3

Description

A Python to C compiler

Added to portage

2019-01-20

exo - 0.12.4
Ebuild name:

xfce-base/exo-0.12.4

Description

Extensions, widgets and framework library with session support for Xfce

Added to portage

2019-01-20

glances - 3.1.0
Ebuild name:

sys-process/glances-3.1.0

Description

CLI curses based monitoring tool

Added to portage

2019-01-20

kodi-pvr-mediaportal-tvserver - 3.5.16
Ebuild name:

media-plugins/kodi-pvr-mediaportal-tvserver-3.5.16

Description

Kodi's MediaPortal TVServer client addon

Added to portage

2019-01-20

libuv - 1.25.0
Ebuild name:

dev-libs/libuv-1.25.0

Description

Cross-platform asychronous I/O

Added to portage

2019-01-20

libwebp - 1.0.2
Ebuild name:

media-libs/libwebp-1.0.2

Description

A lossy image compression format

Added to portage

2019-01-20

linuxptp - 2.0
Ebuild name:

net-misc/linuxptp-2.0

Description

The Linux Precision Time Protocol (PTP) implementation

Added to portage

2019-01-20

mesa - 18.3.2
Ebuild name:

media-libs/mesa-18.3.2

Description

OpenGL-like graphic library for Linux

Added to portage

2019-01-20

nagios-core - 4.4.3-r1
Ebuild name:

net-analyzer/nagios-core-4.4.3-r1

Description

Nagios core - monitoring daemon, web GUI, and documentation

Added to portage

2019-01-20

pam_ssh - 2.3
Ebuild name:

sys-auth/pam_ssh-2.3

Description

Uses ssh-agent to provide single sign-on

Added to portage

2019-01-20

py3status - 3.16
Ebuild name:

x11-misc/py3status-3.16

Description

py3status is an extensible i3status wrapper written in python

Added to portage

2019-01-20

pygit2 - 0.27.4
Ebuild name:

dev-python/pygit2-0.27.4

Description

Python bindings for libgit2

Added to portage

2019-01-20

sass - 3.5.7-r1
Ebuild name:

dev-ruby/sass-3.5.7-r1

Description

An extension of CSS3, adding nested rules, variables, mixins, and more

Added to portage

2019-01-20

sass - 3.7.3
Ebuild name:

dev-ruby/sass-3.7.3

Description

An extension of CSS3, adding nested rules, variables, mixins, and more

Added to portage

2019-01-20

scrollz - 2.3
Ebuild name:

net-irc/scrollz-2.3

Description

Advanced IRC client based on ircII

Added to portage

2019-01-20

tlf - 1.3.2
Ebuild name:

media-radio/tlf-1.3.2

Description

Console-mode amateur radio contest logger

Added to portage

2019-01-20

tvheadend - 4.2.8
Ebuild name:

media-tv/tvheadend-4.2.8

Description

Tvheadend is a TV streaming server and digital video recorder

Added to portage

2019-01-20

upower - 0.99.9-r1
Ebuild name:

sys-power/upower-0.99.9-r1

Description

D-Bus abstraction for enumerating power devices, querying history and st

Added to portage

2019-01-20

xfce4-whiskermenu-plugin - 2.3.1
Ebuild name:

xfce-extra/xfce4-whiskermenu-plugin-2.3.1

Description

Alternate application launcher for Xfce

Added to portage

2019-01-20

rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2018 Sascha Nitsch Unternehmensberatung UG(haftungsbeschänkt)
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.1 ms