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:

43495

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
2018-11-13
drupal - 7.61
Ebuild name:

www-apps/drupal-7.61

Description

PHP-based open-source platform and content management system

Added to portage

2018-11-13

hplip - 3.18.10
Ebuild name:

net-print/hplip-3.18.10

Description

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

Added to portage

2018-11-13

libmicrohttpd - 0.9.60
Ebuild name:

net-libs/libmicrohttpd-0.9.60

Description

Small C library to run an HTTP server as part of another application

Added to portage

2018-11-13

libreswan - 3.27-r1
Ebuild name:

net-vpn/libreswan-3.27-r1

Description

IPsec implementation for Linux, fork of Openswan

Added to portage

2018-11-13

mesa - 18.3.0_rc2
Ebuild name:

media-libs/mesa-18.3.0_rc2

Description

OpenGL-like graphic library for Linux

Added to portage

2018-11-13

openssl - 1.0.2p-r1
Ebuild name:

dev-libs/openssl-1.0.2p-r1

Description

full-strength general purpose cryptography library (including SSL and TL

Added to portage

2018-11-13

openssl - 1.1.0i-r2
Ebuild name:

dev-libs/openssl-1.1.0i-r2

Description

full-strength general purpose cryptography library (including SSL and TL

Added to portage

2018-11-13

openssl - 1.1.1-r2
Ebuild name:

dev-libs/openssl-1.1.1-r2

Description

full-strength general purpose cryptography library (including SSL and TLS

Added to portage

2018-11-13

plymouth-openrc-plugin - 0.1.2-r1
Ebuild name:

sys-boot/plymouth-openrc-plugin-0.1.2-r1

Description

Plymouth plugin for OpenRC

Added to portage

2018-11-13

razor - 2.85-r3
Ebuild name:

mail-filter/razor-2.85-r3

Description

Distributed, collaborative spam detection and filtering network

Added to portage

2018-11-13

redis - 5.0.1
Ebuild name:

dev-db/redis-5.0.1

Description

A persistent caching system, key-value and data structures database

Added to portage

2018-11-13

2018-11-12
alacritty - 0.2.2
Ebuild name:

x11-terms/alacritty-0.2.2

Description

GPU-accelerated terminal emulator

Added to portage

2018-11-12

android-file-transfer-linux - 3.6
Ebuild name:

sys-fs/android-file-transfer-linux-3.6

Description

Android File Transfer for Linux

Added to portage

2018-11-12

chrome-binary-plugins - 70.0.3538.102
Ebuild name:

www-plugins/chrome-binary-plugins-70.0.3538.102

Description

Binary plugins from Google Chrome for use in Chromi

Added to portage

2018-11-12

chrome-binary-plugins - 71.0.3578.44_beta
Ebuild name:

www-plugins/chrome-binary-plugins-71.0.3578.44_beta

Description

Binary plugins from Google Chrome for use in Ch

Added to portage

2018-11-12

chrome-binary-plugins - 72.0.3602.2_alpha
Ebuild name:

www-plugins/chrome-binary-plugins-72.0.3602.2_alpha

Description

Binary plugins from Google Chrome for use in Ch

Added to portage

2018-11-12

distorm64 - 3.3.8
Ebuild name:

dev-libs/distorm64-3.3.8

Description

The ultimate disassembler library (X86-32, X86-64)

Added to portage

2018-11-12

drupal - 8.6.3
Ebuild name:

www-apps/drupal-8.6.3

Description

PHP-based open-source platform and content management system

Added to portage

2018-11-12

ell - 0.14
Ebuild name:

dev-libs/ell-0.14

Description

Embedded Linux Library provides core, low-level functionality for system daemons

Added to portage

2018-11-12

emmet - 9999
Ebuild name:

app-vim/emmet-9999

Description

vim plugin HTML and CSS hi-speed coding

Added to portage

2018-11-12

git-sources - 4.20_rc2
Ebuild name:

sys-kernel/git-sources-4.20_rc2

Description

The very latest -git version of the Linux kernel

Added to portage

2018-11-12

google-chrome - 70.0.3538.102
Ebuild name:

www-client/google-chrome-70.0.3538.102

Description

The web browser from Google

Added to portage

2018-11-12

google-chrome-beta - 71.0.3578.44
Ebuild name:

www-client/google-chrome-beta-71.0.3578.44

Description

The web browser from Google

Added to portage

2018-11-12

google-chrome-unstable - 72.0.3602.2
Ebuild name:

www-client/google-chrome-unstable-72.0.3602.2

Description

The web browser from Google

Added to portage

2018-11-12

gromacs - 2018.3-r1
Ebuild name:

sci-chemistry/gromacs-2018.3-r1

Description

The ultimate molecular dynamics simulation package

Added to portage

2018-11-12

gromacs - 2018.4
Ebuild name:

sci-chemistry/gromacs-2018.4

Description

The ultimate molecular dynamics simulation package

Added to portage

2018-11-12

jenkins-bin - 2.138.3
Ebuild name:

dev-util/jenkins-bin-2.138.3

Description

Extensible continuous integration server

Added to portage

2018-11-12

kdepim-runtime - 18.08.3-r1
Ebuild name:

kde-apps/kdepim-runtime-18.08.3-r1

Description

Runtime plugin collection to extend the functionality of KDE PIM

Added to portage

2018-11-12

kodi-audiodecoder-timidity - 1.1.0-r1
Ebuild name:

media-plugins/kodi-audiodecoder-timidity-1.1.0-r1

Description

Timidity decoder addon for Kodi

Added to portage

2018-11-12

kodi-audiodecoder-timidity - 2.0.1
Ebuild name:

media-plugins/kodi-audiodecoder-timidity-2.0.1

Description

Timidity decoder addon for Kodi

Added to portage

2018-11-12

kodi-inputstream-adaptive - 2.3.8
Ebuild name:

media-plugins/kodi-inputstream-adaptive-2.3.8

Description

Kodi's Adaptive inputstream addon

Added to portage

2018-11-12

kodi-pvr-mythtv - 5.8.19
Ebuild name:

media-plugins/kodi-pvr-mythtv-5.8.19

Description

MythTV PVR for Kodi

Added to portage

2018-11-12

libwebp - 1.0.1_rc2
Ebuild name:

media-libs/libwebp-1.0.1_rc2

Description

A lossy image compression format

Added to portage

2018-11-12

lxd - 3.7
Ebuild name:

app-emulation/lxd-3.7

Description

Fast, dense and secure container management

Added to portage

2018-11-12

megatools - 1.10.2-r1
Ebuild name:

net-misc/megatools-1.10.2-r1

Description

Command line tools and C library for accessing Mega cloud storage

Added to portage

2018-11-12

moodle - 3.1.15
Ebuild name:

www-apps/moodle-3.1.15

Description

The Moodle Course Management System

Added to portage

2018-11-12

moodle - 3.3.9
Ebuild name:

www-apps/moodle-3.3.9

Description

The Moodle Course Management System

Added to portage

2018-11-12

moodle - 3.4.6
Ebuild name:

www-apps/moodle-3.4.6

Description

The Moodle Course Management System

Added to portage

2018-11-12

moodle - 3.5.3
Ebuild name:

www-apps/moodle-3.5.3

Description

The Moodle Course Management System

Added to portage

2018-11-12

mtools - 4.0.20
Ebuild name:

sys-fs/mtools-4.0.20

Description

utilities to access MS-DOS disks from Unix without mounting them

Added to portage

2018-11-12

nano - 3.2
Ebuild name:

app-editors/nano-3.2

Description

GNU GPL'd Pico clone with more functionality

Added to portage

2018-11-12

nss_wrapper - 1.1.5
Ebuild name:

sys-libs/nss_wrapper-1.1.5

Description

A wrapper for the user, group and hosts NSS API

Added to portage

2018-11-12

php - 7.1.24
Ebuild name:

dev-lang/php-7.1.24

Description

The PHP language runtime engine

Added to portage

2018-11-12

php - 7.2.12
Ebuild name:

dev-lang/php-7.2.12

Description

The PHP language runtime engine

Added to portage

2018-11-12

php - 7.3.0_rc5
Ebuild name:

dev-lang/php-7.3.0_rc5

Description

The PHP language runtime engine

Added to portage

2018-11-12

regexp_parser - 1.2.0
Ebuild name:

dev-ruby/regexp_parser-1.2.0

Description

A library for tokenizing, lexing, and parsing Ruby regular expressions

Added to portage

2018-11-12

seabios - 1.11.0-r1
Ebuild name:

sys-firmware/seabios-1.11.0-r1

Description

Open Source implementation of a 16-bit x86 BIOS

Added to portage

2018-11-12

slic3r - 1.3.0-r1
Ebuild name:

media-gfx/slic3r-1.3.0-r1

Description

A mesh slicer to generate G-code for fused-filament-fabrication (3D print

Added to portage

2018-11-12

sudo - 1.8.26_rc1
Ebuild name:

app-admin/sudo-1.8.26_rc1

Description

Allows users or groups to run commands as other users

Added to portage

2018-11-12

tiff - 4.0.10
Ebuild name:

media-libs/tiff-4.0.10

Description

Tag Image File Format (TIFF) library

Added to portage

2018-11-12

vanilla-sources - 4.14.80
Ebuild name:

sys-kernel/vanilla-sources-4.14.80

Description

Full sources for the Linux kernel

Added to portage

2018-11-12

vanilla-sources - 4.18.18
Ebuild name:

sys-kernel/vanilla-sources-4.18.18

Description

Full sources for the Linux kernel

Added to portage

2018-11-12

vanilla-sources - 4.4.163
Ebuild name:

sys-kernel/vanilla-sources-4.4.163

Description

Full sources for the Linux kernel

Added to portage

2018-11-12

vanilla-sources - 4.9.136
Ebuild name:

sys-kernel/vanilla-sources-4.9.136

Description

Full sources for the Linux kernel

Added to portage

2018-11-12

xfce4-notifyd - 0.4.3-r1
Ebuild name:

xfce-extra/xfce4-notifyd-0.4.3-r1

Description

Notification daemon for the Xfce desktop environment

Added to portage

2018-11-12

xfsprogs - 4.19.0
Ebuild name:

sys-fs/xfsprogs-4.19.0

Description

xfs filesystem utilities

Added to portage

2018-11-12

zstd - 1.3.7-r1
Ebuild name:

app-arch/zstd-1.3.7-r1

Description

zstd fast compression library

Added to portage

2018-11-12

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