Our goal here is to first look at reads on everything you commonly use when you
use a linux computer, where be it common command line utilities, or GUI apps such
as Google Chrome, or Dolphin – while they run. Then we take the list, and take
strip out the extreneous information, then feed it into a locked memory cache.
To store files cached in memory we can use vmtouch. We can deamonize it to “lock”,
or keep everything we feed into it in memory, so that when you go to run your
program, instead of reading off the disk, you read from memory… which is roughly
25 times faster than most drive storage.
Here I demo how this looks with the memory cache off (first test), and then on
for the second test. Since we purge dirty pages and sync before each test, we
we get a realistic representation of what happens when using this, verses when not.
As you can see, we’re now pulling things from memory at a rate of abou 26.9 times as
fast.
Pulling what we want into memory
Hint Ideally this should be run as a startup script!
So I wrote this script that automously detects which executable files are used
commonly, then adds them to the cache that is then loaded on startup.
The script:
So you’ll need to train it so to speak, by using your computer normally for a couple mintes,
while it has the inotify watches in place on the
1
/bin
1
/usr/bin
1
/lib
and
1
/usr/lib
directories. It should then load everything up, and you can tell it to autostart when your
desktop environment starts, or on system boot to make use seamless. The results should be
reflected once it states it is done, and vmtouch is deamonized. You should be able to feel
the difference.
Hope this has helped you give a system a boost!
The slower your drive is in comparison to your RAM, the more difference this will make!