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:

67089

userrating:

average rating: 1.2 (8 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.4 (8 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
2024-03-29
libreoffice-l10n - 24.2.2.2
Ebuild name:

app-office/libreoffice-l10n-24.2.2.2

Description

Translations for the Libreoffice suite

Added to portage

2024-03-29

memcached - 1.6.26
Ebuild name:

net-misc/memcached-1.6.26

Description

High-performance, distributed memory object caching system

Added to portage

2024-03-29

pkgcheck - 0.10.29
Ebuild name:

dev-util/pkgcheck-0.10.29

Description

pkgcore-based QA utility for ebuild repos

Added to portage

2024-03-29

systemd-utils - 254.10-r1
Ebuild name:

sys-apps/systemd-utils-254.10-r1

Description

Utilities split out from systemd for OpenRC users

Added to portage

2024-03-29

systemd-utils - 254.8-r1
Ebuild name:

sys-apps/systemd-utils-254.8-r1

Description

Utilities split out from systemd for OpenRC users

Added to portage

2024-03-29

virtualbox-guest-additions - 7.0.14-r2
Ebuild name:

app-emulation/virtualbox-guest-additions-7.0.14-r2

Description

VirtualBox kernel modules and user-space tools f

Added to portage

2024-03-29

2024-03-28
alacritty - 0.13.2
Ebuild name:

x11-terms/alacritty-0.13.2

Description

GPU-accelerated terminal emulator

Added to portage

2024-03-28

aspell-cy - 0.50.3-r1
Ebuild name:

app-dicts/aspell-cy-0.50.3-r1

Description

Aspell () language dictionary

Added to portage

2024-03-28

awscli - 1.32.72
Ebuild name:

app-admin/awscli-1.32.72

Description

Universal Command Line Environment for AWS

Added to portage

2024-03-28

bedrock-server - 1.20.72.01
Ebuild name:

games-server/bedrock-server-1.20.72.01

Description

The official bedrock (non-java) based server for the sandbox

Added to portage

2024-03-28

boto3 - 1.34.72
Ebuild name:

dev-python/boto3-1.34.72

Description

The AWS SDK for Python

Added to portage

2024-03-28

botocore - 1.34.72
Ebuild name:

dev-python/botocore-1.34.72

Description

Low-level, data-driven core of boto 3

Added to portage

2024-03-28

btrfs-progs - 6.8
Ebuild name:

sys-fs/btrfs-progs-6.8

Description

Btrfs filesystem utilities

Added to portage

2024-03-28

bugbite-cli - 0.0.7-r1
Ebuild name:

dev-util/bugbite-cli-0.0.7-r1

Description

A command line tool for bug, issue, and ticket mangling

Added to portage

2024-03-28

build - 1.2.0
Ebuild name:

dev-python/build-1.2.0

Description

A simple, correct PEP517 package builder

Added to portage

2024-03-28

concurrencykit - 0.7.2
Ebuild name:

dev-libs/concurrencykit-0.7.2

Description

A library with concurrency related algorithms and data structures in

Added to portage

2024-03-28

coreutils - 9.5
Ebuild name:

sys-apps/coreutils-9.5

Description

Standard GNU utilities (chmod, cp, dd, ls, sort, tr, head, wc, who,...)

Added to portage

2024-03-28

curl - 8.7.1
Ebuild name:

net-misc/curl-8.7.1

Description

A Client that groks URLs

Added to portage

2024-03-28

dask-expr - 1.0.5
Ebuild name:

dev-python/dask-expr-1.0.5

Description

High Level Expressions for Dask

Added to portage

2024-03-28

django-configurations - 2.5.1
Ebuild name:

dev-python/django-configurations-2.5.1

Description

A helper for organizing Django settings

Added to portage

2024-03-28

django-filter - 24.2
Ebuild name:

dev-python/django-filter-24.2

Description

Django app allowing declarative dynamic QuerySet filtering from URL p

Added to portage

2024-03-28

dmenu - 5.3
Ebuild name:

x11-misc/dmenu-5.3

Description

a generic, highly customizable, and efficient menu for the X Window System

Added to portage

2024-03-28

eduke32 - 20240316.10564
Ebuild name:

games-fps/eduke32-20240316.10564

Description

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

Added to portage

2024-03-28

exo - 1.76.2
Ebuild name:

app-admin/exo-1.76.2

Description

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

Added to portage

2024-03-28

gvm-libs - 22.9.0
Ebuild name:

net-analyzer/gvm-libs-22.9.0

Description

Greenbone Vulnerability Management (GVM) libraries

Added to portage

2024-03-28

hcloud - 1.34.0
Ebuild name:

dev-python/hcloud-1.34.0

Description

Official Hetzner Cloud python library

Added to portage

2024-03-28

httpcore - 1.0.5
Ebuild name:

dev-python/httpcore-1.0.5

Description

A minimal low-level HTTP client

Added to portage

2024-03-28

intel_clc - 24.0.4
Ebuild name:

dev-util/intel_clc-24.0.4

Description

intel_clc tool used for building OpenCL C to SPIR-V

Added to portage

2024-03-28

ipykernel - 6.29.4
Ebuild name:

dev-python/ipykernel-6.29.4

Description

IPython Kernel for Jupyter

Added to portage

2024-03-28

irqbalance - 1.9.4
Ebuild name:

sys-apps/irqbalance-1.9.4

Description

Distribute hardware interrupts across processors on a multiprocessor syst

Added to portage

2024-03-28

kombu - 5.3.6
Ebuild name:

dev-python/kombu-5.3.6

Description

AMQP Messaging Framework for Python

Added to portage

2024-03-28

lxcfs - 6.0.0
Ebuild name:

sys-fs/lxcfs-6.0.0

Description

FUSE filesystem for LXC

Added to portage

2024-03-28

mcelog - 198
Ebuild name:

app-admin/mcelog-198

Description

A tool to log and decode Machine Check Exceptions

Added to portage

2024-03-28

mesa - 24.0.4
Ebuild name:

media-libs/mesa-24.0.4

Description

OpenGL-like graphic library for Linux

Added to portage

2024-03-28

moar - 1.23.9
Ebuild name:

sys-apps/moar-1.23.9

Description

Pager designed to do the right thing without any configuration

Added to portage

2024-03-28

moto - 5.0.4
Ebuild name:

dev-python/moto-5.0.4

Description

Mock library for boto

Added to portage

2024-03-28

netdata - 1.45.1
Ebuild name:

net-analyzer/netdata-1.45.1

Description

Linux real time system monitoring, done right

Added to portage

2024-03-28

orjson - 3.10.0
Ebuild name:

dev-python/orjson-3.10.0

Description

Fast, correct Python JSON library supporting dataclasses, datetimes, and n

Added to portage

2024-03-28

pkgconf - 2.2.0
Ebuild name:

dev-util/pkgconf-2.2.0

Description

pkg-config compatible replacement with no dependencies other than C99

Added to portage

2024-03-28

pkgcore - 0.12.26
Ebuild name:

sys-apps/pkgcore-0.12.26

Description

a framework for package management

Added to portage

2024-03-28

prowlarr-bin - 1.15.0.4361
Ebuild name:

www-apps/prowlarr-bin-1.15.0.4361

Description

An indexer manager/proxy to integrate with your various PVR apps

Added to portage

2024-03-28

pyghmi - 1.5.68
Ebuild name:

dev-python/pyghmi-1.5.68

Description

A pure python implementation of IPMI protocol

Added to portage

2024-03-28

pymongo - 4.6.3
Ebuild name:

dev-python/pymongo-4.6.3

Description

Python driver for MongoDB

Added to portage

2024-03-28

requests-mock - 1.12.0
Ebuild name:

dev-python/requests-mock-1.12.0

Description

Mock out responses from the requests package

Added to portage

2024-03-28

rt-sources - 5.10.213_p105
Ebuild name:

sys-kernel/rt-sources-5.10.213_p105

Description

Full Linux . kernel sources with the CONFIG_PREEMPT_RT patch

Added to portage

2024-03-28

rt-sources - 5.4.271_p89
Ebuild name:

sys-kernel/rt-sources-5.4.271_p89

Description

Full Linux . kernel sources with the CONFIG_PREEMPT_RT patch

Added to portage

2024-03-28

rt-sources - 6.1.82_p27
Ebuild name:

sys-kernel/rt-sources-6.1.82_p27

Description

Full Linux . kernel sources with the CONFIG_PREEMPT_RT patch

Added to portage

2024-03-28

rt-sources - 6.6.22_p27
Ebuild name:

sys-kernel/rt-sources-6.6.22_p27

Description

Full Linux . kernel sources with the CONFIG_PREEMPT_RT patch

Added to portage

2024-03-28

rustls-ffi - 0.12.1-r1
Ebuild name:

net-libs/rustls-ffi-0.12.1-r1

Description

C-to-rustls bindings

Added to portage

2024-03-28

selenium - 4.19.0
Ebuild name:

dev-python/selenium-4.19.0

Description

Python language binding for Selenium Remote Control

Added to portage

2024-03-28

shim - 15.8
Ebuild name:

sys-boot/shim-15.8

Description

Fedora's signed UEFI shim

Added to portage

2024-03-28

sonarr-bin - 4.0.2.1408
Ebuild name:

www-apps/sonarr-bin-4.0.2.1408

Description

Sonarr is a Smart PVR for newsgroup and bittorrent users

Added to portage

2024-03-28

sysvinit - 3.09
Ebuild name:

sys-apps/sysvinit-3.09

Description

/sbin/init - parent of all processes

Added to portage

2024-03-28

tavern - 2.10.1
Ebuild name:

dev-python/tavern-2.10.1

Description

A tool, library, and Pytest plugin for testing RESTful APIs

Added to portage

2024-03-28

tree-sitter-c - 0.21.0
Ebuild name:

dev-libs/tree-sitter-c-0.21.0

Description

C grammar for Tree-sitter

Added to portage

2024-03-28

tree-sitter-php - 0.22.2
Ebuild name:

dev-libs/tree-sitter-php-0.22.2

Description

PHP grammar for Tree-sitter

Added to portage

2024-03-28

tree-sitter-scala - 0.21.0
Ebuild name:

dev-libs/tree-sitter-scala-0.21.0

Description

Scala grammar for Tree-sitter

Added to portage

2024-03-28

unearth - 0.15.1
Ebuild name:

dev-python/unearth-0.15.1

Description

A utility to fetch and download python packages

Added to portage

2024-03-28

util-linux - 2.39.3-r6
Ebuild name:

sys-apps/util-linux-2.39.3-r6

Description

Various useful Linux utilities

Added to portage

2024-03-28

uutils-coreutils - 0.0.25
Ebuild name:

sys-apps/uutils-coreutils-0.0.25

Description

GNU coreutils rewritten in Rust

Added to portage

2024-03-28

uv - 0.1.24
Ebuild name:

dev-python/uv-0.1.24

Description

A Python package installer and resolver, written in Rust

Added to portage

2024-03-28

xen - 4.17.4_pre1
Ebuild name:

app-emulation/xen-4.17.4_pre1

Description

The Xen virtual machine monitor

Added to portage

2024-03-28

xen-tools - 4.17.4_pre1
Ebuild name:

app-emulation/xen-tools-4.17.4_pre1

Description

Xen tools including QEMU and xl

Added to portage

2024-03-28

xmlstarlet - 1.6.1-r2
Ebuild name:

app-text/xmlstarlet-1.6.1-r2

Description

A set of tools to transform, query, validate, and edit XML documents

Added to portage

2024-03-28

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