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:

40715

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.0 (1 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
2018-05-20
asciinema - 2.0.1
Ebuild name:

app-misc/asciinema-2.0.1

Description

Command line recorder for asciinema.org service

Added to portage

2018-05-20

byacc - 20180510
Ebuild name:

dev-util/byacc-20180510

Description

the best variant of the Yacc parser generator

Added to portage

2018-05-20

chrootuid - 1.3-r2
Ebuild name:

app-admin/chrootuid-1.3-r2

Description

Run a network service at low privilege level and restricted file system

Added to portage

2018-05-20

collectd - 5.8.0
Ebuild name:

app-metrics/collectd-5.8.0

Description

Collects system statistics and provides mechanisms to store the values

Added to portage

2018-05-20

dash - 0.5.10.2
Ebuild name:

app-shells/dash-0.5.10.2

Description

Debian Almquist Shell

Added to portage

2018-05-20

debianutils - 4.8.6
Ebuild name:

sys-apps/debianutils-4.8.6

Description

A selection of tools from Debian

Added to portage

2018-05-20

debootstrap - 1.0.99
Ebuild name:

dev-util/debootstrap-1.0.99

Description

Debian/Ubuntu bootstrap scripts

Added to portage

2018-05-20

hplip - 3.18.4
Ebuild name:

net-print/hplip-3.18.4

Description

HP Linux Imaging and Printing - Print, scan, fax drivers and service tools

Added to portage

2018-05-20

irqbalance - 1.4.0
Ebuild name:

sys-apps/irqbalance-1.4.0

Description

Distribute hardware interrupts across processors on a multiprocessor syst

Added to portage

2018-05-20

kpeg - 1.1.0-r1
Ebuild name:

dev-ruby/kpeg-1.1.0-r1

Description

A simple PEG library for Ruby

Added to portage

2018-05-20

libsfml - 2.5.0
Ebuild name:

media-libs/libsfml-2.5.0

Description

Simple and Fast Multimedia Library (SFML)

Added to portage

2018-05-20

mbuffer - 20180505
Ebuild name:

sys-block/mbuffer-20180505

Description

M(easuring)buffer is a replacement for buffer with additional functional

Added to portage

2018-05-20

meson - 0.46.1
Ebuild name:

dev-util/meson-0.46.1

Description

Open source build system

Added to portage

2018-05-20

neofetch - 4.0.1
Ebuild name:

app-misc/neofetch-4.0.1

Description

Simple information system script

Added to portage

2018-05-20

pcl - 1.12-r1
Ebuild name:

dev-libs/pcl-1.12-r1

Description

Portable Coroutine Library

Added to portage

2018-05-20

pwcrypt - 1.2.2-r2
Ebuild name:

app-admin/pwcrypt-1.2.2-r2

Description

An improved version of cli-crypt (encrypts data sent to it from the cli)

Added to portage

2018-05-20

pysolfc - 2.2.0
Ebuild name:

games-board/pysolfc-2.2.0

Description

An exciting collection of more than 1000 solitaire card games

Added to portage

2018-05-20

random2 - 1.0.1
Ebuild name:

dev-python/random2-1.0.1

Description

Python-2.7 random module ported to python-3

Added to portage

2018-05-20

rdoc - 6.0.4
Ebuild name:

dev-ruby/rdoc-6.0.4

Description

An extended version of the RDoc library from Ruby 1.8

Added to portage

2018-05-20

rt-sources - 4.14.40_p30
Ebuild name:

sys-kernel/rt-sources-4.14.40_p30

Description

Full Linux . kernel sources with the CONFIG_PREEMPT_RT patch

Added to portage

2018-05-20

rt-sources - 4.16.8_p2
Ebuild name:

sys-kernel/rt-sources-4.16.8_p2

Description

Full Linux . kernel sources with the CONFIG_PREEMPT_RT patch

Added to portage

2018-05-20

rt-sources - 4.4.131_p148
Ebuild name:

sys-kernel/rt-sources-4.4.131_p148

Description

Full Linux . kernel sources with the CONFIG_PREEMPT_RT patch

Added to portage

2018-05-20

rt-sources - 4.9.98_p76
Ebuild name:

sys-kernel/rt-sources-4.9.98_p76

Description

Full Linux . kernel sources with the CONFIG_PREEMPT_RT patch

Added to portage

2018-05-20

runit - 2.1.1-r2
Ebuild name:

sys-process/runit-2.1.1-r2

Description

A UNIX init scheme with service supervision

Added to portage

2018-05-20

sanitize - 4.6.5
Ebuild name:

dev-ruby/sanitize-4.6.5

Description

Sanitize is a whitelist-based HTML sanitizer

Added to portage

2018-05-20

toolz - 0.9.0
Ebuild name:

dev-python/toolz-0.9.0

Description

List processing tools and functional utilities

Added to portage

2018-05-20

2018-05-19
SchemaObject - 0.5.8
Ebuild name:

dev-python/SchemaObject-0.5.8

Description

A simple Python object interface to a MySQL database schema

Added to portage

2018-05-19

SchemaSync - 0.9.5
Ebuild name:

dev-db/SchemaSync-0.9.5

Description

MySQL Schema Versioning and Migration Utility

Added to portage

2018-05-19

ansible - 2.5.3
Ebuild name:

app-admin/ansible-2.5.3

Description

Model-driven deployment, config management, and command execution framework

Added to portage

2018-05-19

autoprefixer-rails - 8.5.0
Ebuild name:

dev-ruby/autoprefixer-rails-8.5.0

Description

Add vendor prefixes to CSS rules using values from the Can I Use

Added to portage

2018-05-19

calamares - 3.2.0
Ebuild name:

app-admin/calamares-3.2.0

Description

Distribution-independent installer framework

Added to portage

2018-05-19

cdiff - 1.0
Ebuild name:

dev-util/cdiff-1.0

Description

Colored, side-by-side diff terminal viewer

Added to portage

2018-05-19

electrum - 3.1.3
Ebuild name:

net-misc/electrum-3.1.3

Description

User friendly Bitcoin client

Added to portage

2018-05-19

elogv - 0.7.7.1
Ebuild name:

app-portage/elogv-0.7.7.1

Description

Curses based utility to parse the contents of elogs created by Portage

Added to portage

2018-05-19

fido2 - 0.3.0
Ebuild name:

dev-python/fido2-0.3.0

Description

Python based FIDO 2.0 library

Added to portage

2018-05-19

gcc - 6.4.0-r2
Ebuild name:

sys-devel/gcc-6.4.0-r2

Description

The GNU Compiler Collection

Added to portage

2018-05-19

gcc - 7.3.0-r3
Ebuild name:

sys-devel/gcc-7.3.0-r3

Description

The GNU Compiler Collection

Added to portage

2018-05-19

lastpass-cli - 1.3.1
Ebuild name:

app-admin/lastpass-cli-1.3.1

Description

Interfaces with LastPass.com from the command line.

Added to portage

2018-05-19

lazarus - 1.8.2
Ebuild name:

dev-lang/lazarus-1.8.2

Description

Lazarus IDE is a feature rich visual programming environment emulating Delph

Added to portage

2018-05-19

libidn2 - 2.0.5
Ebuild name:

net-dns/libidn2-2.0.5

Description

An implementation of the IDNA2008 specifications (RFCs 5890, 5891, 5892, 5893

Added to portage

2018-05-19

lklug - 0.6-r1
Ebuild name:

media-fonts/lklug-0.6-r1

Description

Sinhala font

Added to portage

2018-05-19

plasma-desktop - 5.12.5-r1
Ebuild name:

kde-plasma/plasma-desktop-5.12.5-r1

Description

KDE Plasma desktop

Added to portage

2018-05-19

sent - 1-r1
Ebuild name:

x11-misc/sent-1-r1

Description

Simple plaintext presentation tool

Added to portage

2018-05-19

solid - 5.46.0-r1
Ebuild name:

kde-frameworks/solid-5.46.0-r1

Description

Provider for platform independent hardware discovery, abstraction an

Added to portage

2018-05-19

swi-prolog - 7.7.13
Ebuild name:

dev-lang/swi-prolog-7.7.13

Description

free, small, and standard compliant Prolog compiler

Added to portage

2018-05-19

wireguard - 0.0.20180519
Ebuild name:

net-vpn/wireguard-0.0.20180519

Description

Simple yet fast and modern VPN that utilizes state-of-the-art crypto

Added to portage

2018-05-19

wireshark - 2.6.0-r2
Ebuild name:

net-analyzer/wireshark-2.6.0-r2

Description

A network protocol analyzer formerly known as ethereal

Added to portage

2018-05-19

wpa_supplicant - 2.6-r8
Ebuild name:

net-wireless/wpa_supplicant-2.6-r8

Description

IEEE 802.1X/WPA supplicant for secure wireless transfers

Added to portage

2018-05-19

yubikey-manager - 0.7.0
Ebuild name:

app-crypt/yubikey-manager-0.7.0

Description

Python library and command line tool for configuring a YubiKey

Added to portage

2018-05-19

zabbix - 3.0.17
Ebuild name:

net-analyzer/zabbix-3.0.17

Description

ZABBIX is software for monitoring of your applications, network and serv

Added to portage

2018-05-19

zabbix - 3.4.9
Ebuild name:

net-analyzer/zabbix-3.4.9

Description

ZABBIX is software for monitoring of your applications, network and serve

Added to portage

2018-05-19

zopfli - 1.0.2
Ebuild name:

app-arch/zopfli-1.0.2

Description

Very good, but slow, deflate or zlib compression

Added to portage

2018-05-19

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