A great application which should be installed by default. Preload checks and analyses the users behaviour and then begins to preload often used applications to the system memory, before they have been started.
If you have 8 GB of RAM or more available, it absulutely makes sense to preload applications like Firefox, Thunderbird, Spotify.
If you then launch them they are significantly faster.
Keep in mind after install and configuration. The faster startup effect will be recognizable after some days – preload takes a while to analyze the users behavior.
As an example my configuration for 32 GB of memory.
1. Install preload
sudo apt install preload
start it
sudo systemctl start preload
check if everything is running
systemctl status preload
the output should be something like this
preload.service - LSB: Adaptive readahead daemon
Loaded: loaded (/etc/init.d/preload; generated)
Active: active (running) since Mon 2025-02-03 20:28:16 CET; 16min ago
Docs: man:systemd-sysv-generator(8)
Tasks: 1 (limit: 37634)
Memory: 479.8M (peak: 484.5M)
then you just have to enable it to be started on boot
sudo systemctl enable preload
2. Edit the config
This is where the magic happens /etc/preload.conf
Edit the /etc/preload.conf
sudo nano /etc/preload.conf
The original preload conf looks like this
[model]
# cycle:
#
# This is the quantum of time for preload. Preload performs
# data gathering and predictions every cycle. Use an even
# number.
#
# Note: Setting this parameter too low may reduce system performance
# and stability.
#
# unit: seconds
# default: 20
#
cycle = 20
# usecorrelation:
#
# Whether correlation coefficient should be used in the prediction
# algorithm. There are arguments both for and against using it.
# Currently it's believed that using it results in more accurate
# prediction. The option may be removed in the future.
#
# default: true
usecorrelation = true
# minsize:
#
# Minimum sum of the length of maps of the process for
# preload to consider tracking the application.
#
# Note: Setting this parameter too high will make preload less
# effective, while setting it too low will make it eat
# quadratically more resources, as it tracks more processes.
#
# unit: bytes
# default: 2000000
#
minsize = 2000000
#
# The following control how much memory preload is allowed to use
# for preloading in each cycle. All values are percentages and are
# clamped to -100 to 100.
#
# The total memory preload uses for prefetching is then computed using
# the following formulae:
#
# max (0, TOTAL * memtotal + FREE * memfree) + CACHED * memcached
# where TOTAL, FREE, and CACHED are the respective values read at
# runtime from /proc/meminfo.
#
# memtotal: precentage of total memory
#
# unit: signed_integer_percent
# default: -10
#
memtotal = -10
# memfree: precentage of free memory
#
# unit: signed_integer_percent
# default: 50
#
memfree = 50
# memcached: precentage of cached memory
#
# unit: signed_integer_percent
# default: 0
#
memcached = 0
###########################################################################
[system]
# doscan:
#
# Whether preload should monitor running processes and update its
# model state. Normally you do want that, that's all preload is
# about, but you may want to temporarily turn it off for various
# reasons like testing and only make predictions. Note that if
# scanning is off, predictions are made based on whatever processes
# have been running when preload started and the list of running
# processes is not updated at all.
#
# default: true
doscan = true
# dopredict:
#
# Whether preload should make prediction and prefetch anything off
# the disk. Quite like doscan, you normally want that, that's the
# other half of what preload is about, but you may want to temporarily
# turn it off, to only train the model for example. Note that
# this allows you to turn scan/predict or or off on the fly, by
# modifying the config file and signalling the daemon.
#
# default: true
dopredict = true
# autosave:
#
# Preload will automatically save the state to disk every
# autosave period. This is only relevant if doscan is set to true.
# Note that some janitory work on the model, like removing entries
# for files that no longer exist happen at state save time. So,
# turning off autosave completely is not advised.
#
# unit: seconds
# default: 3600
#
autosave = 3600
# mapprefix:
#
# A list of path prefixes that controll which mapped file are to
# be considered by preload and which not. The list items are
# separated by semicolons. Matching will be stopped as soon as
# the first item is matched. For each item, if item appears at
# the beginning of the path of the file, then a match occurs, and
# the file is accepted. If on the other hand, the item has a
# exclamation mark as its first character, then the rest of the
# item is considered, and if a match happens, the file is rejected.
# For example a value of !/lib/modules;/ means that every file other
# than those in /lib/modules should be accepted. In this case, the
# trailing item can be removed, since if no match occurs, the file is
# accepted. It's advised to make sure /dev is rejected, since
# preload doesn't special-handle device files internally.
#
# Note that /lib matches all of /lib, /lib64, and even /libexec if
# there was one. If one really meant /lib only, they should use
# /lib/ instead.
#
# default: (empty list, accept all)
mapprefix = /usr/;/lib;/var/cache/;!/
# exeprefix:
#
# The syntax for this is exactly the same as for mapprefix. The only
# difference is that this is used to accept or reject binary exectuable
# files instead of maps.
#
# default: (empty list, accept all)
exeprefix = !/usr/sbin/;!/usr/local/sbin/;/usr/;!/
# maxprocs
#
# Maximum number of processes to use to do parallel readahead. If
# equal to 0, no parallel processing is done and all readahead is
# done in-process. Parallel readahead supposedly gives a better I/O
# performance as it allows the kernel to batch several I/O requests
# of nearby blocks.
#
# default: 30
processes = 30
# sortstrategy
#
# The I/O sorting strategy. Ideally this should be automatically
# decided, but it's not currently. One of:
#
# 0 -- SORT_NONE: No I/O sorting.
# Useful on Flash memory for example.
# 1 -- SORT_PATH: Sort based on file path only.
# Useful for network filesystems.
# 2 -- SORT_INODE: Sort based on inode number.
# Does less house-keeping I/O than the next option.
# 3 -- SORT_BLOCK: Sort I/O based on disk block. Most sophisticated.
# And useful for most Linux filesystems.
#
# default: 3
sortstrategy = 3
I edited the values like this
[model]
cycle = 10
usecorrelation = true
minsize = 1000000
memtotal = 15
memfree = 75
memcached = 10
[system]
doscan = true
dopredict = true
autosave = 1800
mapprefix = /usr/;/snap/;/lib/;/var/cache/;/opt/;/var/lib/snapd/snaps/;/var/lib/flatpak/;!/dev/;!/proc/;!/sys/;!/tmp/
exeprefix = /usr/;/snap/;/opt/;/var/lib/snapd/snaps/;/var/lib/flatpak/;!/usr/sbin/;!/usr/local/sbin/;!/bin/
processes = 64
sortstrategy = 3
Explanation. I’ve asked chatGPT to shorten the comments
[model]
cycle = 10
# Time interval (in seconds) for preload to analyze running applications and update its model.
# Lower values make it update more frequently, improving responsiveness but increasing CPU usage.
usecorrelation = true
# Enables correlation-based prediction for better accuracy.
# This helps preload predict app usage patterns more effectively.
minsize = 1000000
# Minimum memory size (in bytes) a process must use to be considered for preloading.
# Lower values allow smaller programs to be tracked, increasing memory usage.
memtotal = 15
# Maximum percentage of total RAM that preload can use for caching.
# Here, up to 15% of total RAM is allocated to preload.
memfree = 75
# Maximum percentage of free RAM preload can utilize.
# If enough free RAM is available, preload can use up to 75% of it.
memcached = 10
# Percentage of cached memory that preload is allowed to use.
# Helps retain frequently accessed data without affecting performance.
[system]
doscan = true
# Enables scanning of running processes to update preload’s model.
# If disabled, preload will only use previously collected data.
dopredict = true
# Allows preload to predict and load applications into memory.
# If disabled, preload will collect data but not preload apps.
autosave = 1800
# Interval (in seconds) for saving preload’s learned data to disk.
# Helps retain app usage patterns after reboots.
mapprefix = /usr/;/snap/;/lib/;/var/cache/;/opt/;/var/lib/snapd/snaps/;/var/lib/flatpak/;!/dev/;!/proc/;!/sys/;!/tmp/
# Specifies which directories preload should consider for tracking libraries and application files.
# Directories starting with "!" are excluded to avoid loading unnecessary or volatile files.
exeprefix = /usr/;/snap/;/opt/;/var/lib/snapd/snaps/;/var/lib/flatpak/;!/usr/sbin/;!/usr/local/sbin/;!/bin/
# Defines which executable paths should be included in preloading.
# Excludes system binaries (/usr/sbin, /usr/local/sbin, /bin) to prioritize user applications.
processes = 64
# Number of parallel processes preload can use for reading ahead.
# Higher values improve performance on multi-core systems.
sortstrategy = 3
# Sorting strategy for preloaded files:
# 0 - No sorting (best for Flash memory)
# 1 - Sort by file path (good for network filesystems)
# 2 - Sort by inode number (less overhead)
# 3 - Sort by disk block (best for most Linux filesystems, including SSDs)
regarding mapprefix and exeprefix i also have added /snap/ and flatpack to be checked because most of my applications are installed using snap of flatpack.
If you have about 16GB of memory I’d recommend something like
[model]
cycle = 10
usecorrelation = true
minsize = 1000000
memtotal = 12
memfree = 65
memcached = 10
[system]
doscan = true
dopredict = true
autosave = 1800
mapprefix = /usr/;/snap/;/lib/;/var/cache/;/opt/;/var/lib/snapd/snaps/;/var/lib/flatpak/;!/dev/;!/proc/;!/sys/;!/tmp/
exeprefix = /usr/;/snap/;/opt/;/var/lib/snapd/snaps/;/var/lib/flatpak/;!/usr/sbin/;!/usr/local/sbin/;!/bin/
processes = 48
sortstrategy = 3
I haven’t tested it for 8GB of memory, but this may be a working solution too
[model]
cycle = 10
usecorrelation = true
minsize = 1000000
memtotal = 10
memfree = 50
memcached = 5
[system]
doscan = true
dopredict = true
autosave = 1800
mapprefix = /usr/;/snap/;/lib/;/var/cache/;/opt/;/var/lib/snapd/snaps/;/var/lib/flatpak/;!/dev/;!/proc/;!/sys/;!/tmp/
exeprefix = /usr/;/snap/;/opt/;/var/lib/snapd/snaps/;/var/lib/flatpak/;!/usr/sbin/;!/usr/local/sbin/;!/bin/
processes = 32
sortstrategy = 3
3. Conclusion
As mentioned before you have to wait some days and use your device as usual to get the effect of preload.
Schreibe einen Kommentar