Linux Format - UK (2019-12)

(Antfer) #1
http://www.techradar.com/pro/linux December 2019 LXF257 37

Lightweight Linux


PRELOAD APPS


Most users have a select bunch of apps that they use frequently.
Preload is an adaptive read-ahead daemon that runs in the
background and analyses and monitors the apps that you use.
Based on this ongoing analysis, Preload determines the apps you use
frequently and fetches all the binaries and relevant dependencies
into memory beforehand. This means that when you launch the app,
it starts almost instantaneously since it’s already in the memory.
For example, if you always launch your browser and your email
client soon after booting into the distro, Preload will automatically
load them both into memory when your computer boots up. When
you log in and call on these apps, you’ll be amazed by their launch
times. Its biggest downside is that the act of preloading the binaries
will adversely affect boot times.
Some distros include the Preload daemon by default, and almost
every distro has it in its official repositories. On Ubuntu you can
install it with sudo apt install preload.

Speed governors
To understand this next section, you need to know a
little bit about Linux internals – but don’t worry, it isn’t
really all that technical.
The kernel uses Process Schedulers and I/O
Schedulers. Process schedulers help manage how the
kernel switches between different computational tasks.
Kernel hacker Con Kolivas’ work on fair scheduling led to
Ingo Mólnar’s Completely Fair Scheduler (CFS), which is
the default scheduler on most Linux distros. Kolivas is
involved with several other kernel-level enhancements
including the Brain F**k Scheduler (BFS) and the
Multiple Queue Skiplist Scheduler (MuQSS).
Then there are I/O Schedulers. Two of the most
popular I/O schedulers are the Completely Fair
Queueing (CFQ) and the Budget Fair Queueing (BFQ)
schedulers. On systems with mechanical hard drives,
you should use BFQ and CFQ, these help minimise
I/O interactions. SSDs, meanwhile, are better at
handling I/O operations and you can avoid wasting
computational resources on them using the NOOP
scheduler. You can check which I/O Scheduler you’re
running with cat /sys/block/sda/queue/scheduler.
To take advantage of the new schedulers for a
smoother desktop experience, you’ll get better mileage
with the Liquorix kernel. It includes the MuQSS
scheduler instead of CFS, and BFQ instead of CFQ, and
also includes quite a few other tweaks to make your
installation more responsive. The kernel is available via
a PPA that you can install with:

sudo add-apt-repository ppa:damentz/liquorix
sudo apt-get update
After adding the PPA, install the kernel with:
sudo apt install linux-image-liquorix-amd64 linux-
headers-liquorix-amd64
Besides the Liquorix kernel, there are several
performance-optimised kernel patches available. Con
Koliva has compiled several of these patches into the
-ck kernel patch that you can use to compile your own
performance-enhanced kernel. After you’ve installed it,
you’ll notice performance improvements in everyday
desktop tasks, as well as while playing games and
producing multimedia.
To install the -ck kernel patch, use your distro’s
package manager to first download the kernel source for
the version the patch applies to, along with all the tools
for building your kernel. Then download the patch from
Koliva’s website (www.users.on.net/~%20ckolivas/
kernel) and use the patch command in the kernel
source folder to apply the changes, such as:
sudo patch -p1 < patch-5.*-ck1
Now proceed to build the kernel according to your
distribution’s instructions. If you don’t know what that
means, you can safely ignore this section!

Instead of top, use
the htop utility,
which can easily
sort processes
by various useful
parameters.

Preload won’t be of much use if you launch an app and continue using
it instead of loading different apps and libraries.

3332Decmbr rb2c0194b095678 December 2019LXF257 37


Lightweight Linux


PRELOADAPPS


Mostusershaveaselectbunchofappsthattheyusefrequently.
Preloadisanadaptiveread-aheaddaemonthatrunsinthe
backgroundandanalysesandmonitorstheappsthatyouuse.
Basedonthisongoinganalysis,Preloaddeterminestheappsyouuse
frequentlyandfetchesallthebinariesandrelevantdependencies
intomemorybeforehand.Thismeansthatwhenyoulaunchtheapp,
itstartsalmostinstantaneouslysinceit’salreadyinthememory.
Forexample,ifyoualwayslaunchyourbrowserandyouremail
clientsoonafterbootingintothedistro,Preloadwillautomatically
loadthembothintomemorywhenyourcomputerbootsup.When
youloginandcallontheseapps,you’llbeamazedbytheirlaunch
times.Itsbiggestdownsideisthattheactofpreloadingthebinaries
willadverselyaffectboottimes.
SomedistrosincludethePreloaddaemonbydefault,andalmost
everydistrohasitinitsofficialrepositories.OnUbuntuyoucan
installitwith sudoaptinstallpreload.

Speedgovernors
Tounderstandthisnextsection,youneedtoknowa
littlebitaboutLinuxinternals–butdon’tworry,itisn’t
reallyallthattechnical.
ThekernelusesProcessSchedulersandI/O
Schedulers.Processschedulershelpmanagehowthe
kernelswitchesbetweendifferentcomputationaltasks.
KernelhackerConKolivas’workonfairschedulingledto
IngoMólnar’sCompletelyFairScheduler(CFS),whichis
thedefaultscheduleronmostLinuxdistros.Kolivasis
involvedwithseveralotherkernel-levelenhancements
includingtheBrainF**kScheduler(BFS)andthe
MultipleQueueSkiplistScheduler(MuQSS).
ThenthereareI/OSchedulers.Twoofthemost
popularI/OschedulersaretheCompletelyFair
Queueing(CFQ)andtheBudgetFairQueueing(BFQ)
schedulers.Onsystemswithmechanicalharddrives,
youshoulduseBFQandCFQ,thesehelpminimise
I/Ointeractions.SSDs,meanwhile,arebetterat
handlingI/Ooperationsandyoucanavoidwasting
computationalresourcesonthemusingtheNOOP
scheduler.YoucancheckwhichI/OScheduleryou’re
runningwithcat/sys/block/sda/queue/scheduler.
Totakeadvantageofthenewschedulersfora
smootherdesktopexperience,you’llgetbettermileage
withtheLiquorixkernel.ItincludestheMuQSS
schedulerinsteadofCFS,andBFQinsteadofCFQ,and
alsoincludesquiteafewothertweakstomakeyour
installationmoreresponsive.Thekernelisavailablevia
aPPAthatyoucaninstallwith:


sudoadd-apt-repositoryppa:damentz/liquorix
sudoapt-getupdate
AfteraddingthePPA,installthekernelwith:
sudoaptinstalllinux-image-liquorix-amd64linux-
headers-liquorix-amd64
BesidestheLiquorixkernel,thereareseveral
performance-optimisedkernelpatchesavailable.Con
Kolivahascompiledseveralofthesepatchesintothe
-ckkernelpatchthatyoucanusetocompileyourown
performance-enhancedkernel.Afteryou’veinstalledit,
you’llnoticeperformanceimprovementsineveryday
desktoptasks,aswellaswhileplayinggamesand
producingmultimedia.
Toinstallthe-ckkernelpatch,useyourdistro’s
packagemanagertofirstdownloadthekernelsourcefor
theversionthepatchappliesto,alongwithallthetools
forbuildingyourkernel.Thendownloadthepatchfrom
Koliva’swebsite(www.users.on.net/~%20ckolivas/
kernel)andusethepatch commandinthekernel
sourcefoldertoapplythechanges,suchas:
sudopatch-p1< patch-5.*-ck1
Nowproceedtobuildthekernelaccordingtoyour
distribution’sinstructions.Ifyoudon’tknowwhatthat
means,youcansafelyignorethissection!

Instead of top, use
the htop utility,
which can easily
sort processes
by various useful
parameters.

Preload won’t be of much use if you launch an app and continue using
it instead of loading different apps and libraries.
Free download pdf