Why when I click to open application,firefox or vlc for example,it starts about 5 or 10 seconds after? Can I speed up start times? is it usual to wait 10 seconds to open a browser or any other application like software center? From what it depends? I have celeron dual core cpu 1007u and ivy bridge graphics.. i think it's decent for normal use such as surfing or watching a movies. Thanks in advance.
-
Yes the preload may help which will run silently in the background. Configurations file is /etc/preload.conf. – BDRSuite May 21 '15 at 10:22
-
What's your hardware ? Model ? CPU ? Mass storage (hard disk) ? Though generic advice can be given, good answer may need such information. – Stéphane Gourichon May 21 '15 at 13:47
2 Answers
This Answer is rather a Wiki that Is meant to be read and understood first before attempting to use either Preload or Prelink.
We need to first understand how Applications launch under Linux, I will not comment on Windows. Linux is secure by design, So what do we really mean by that?
Application launch Process
Linux programs typically consist of a binary executable file that refers to multiple shared libraries. These libraries are loaded into memory once and shared by multiple executables. In order to make that happen, the dynamic linker (i.e. ld.so) needs to change the binary in memory such that any addresses of library objects point to the right place in memory. For applications with many shared libraries—GUI programs for example—that process can take some time. For most small programs this dynamic linking is very quick. But when bigger programs are launched it could take time. I mean considerable time.
Linux uses ASLR to randomize the addresses in memory. One of the ideas behind address space layout randomization (ASLR) is to randomize these locations each time a program is run—or library loaded—so that malicious programs cannot easily and reproducibly predict addresses
Let us understand With Context what preloading is and what prelinknig is and how they help reduce application launch times.
First lets take a look at Preloading.
Preloading is the action of putting and keeping target files into the RAM. The benefit is that preloaded applications start more quickly because reading from the RAM is always quicker than from the hard drive. However, part of your RAM will be dedicated to this task, but no more than if you kept the application open. Therefore preloading is best used with large and often-used applications like Firefox and LibreOffice.
Preload is an adaptive, pre-read demon. It observes the applications Starts over a period of time. Understands the application launch behaviour. It collects the information and based on the information starts to preload the libraries required by the programs into the device RAM. Hence over a period of time the Application launch times reduce considerably and applications launch faster.
Since Preload requires memory to store the program code, the system should in any case have more than 1GB of memory.
The increase in speed can be up to 55%. However, this is not detected right after installation. Preload requires a few days or a week or two until a reliable statistic is created. This statistic uses Preload to load the code of the corresponding programs in the memory.
Now Lets look at Prelinking
On most systems, libraries are not changed very often and when a program is run, the operations taken to link the program are the same every time. Prelink takes advantage of this by carrying out the linking and storing it in the executable, in effect prelinking it.
Idealy it nullifies the Randomization of the Addreses which means it is easy to predcit where the libraries are stored hence it results in quick access to the libraries. This in turn reduces the launch time considerably.
The idea behind pre-linking is fairly simple: reduce the amount of time the dynamic linker needs to spend doing these address relocations by doing it in advance and storing the results. The prelink program processes ELF binaries and shared libraries in much the same way that ld.so would, and then adds special ELF sections to the files describing the relocations. When ld.so loads a pre-linked binary or library, it checks these sections and, if the libraries are loaded at the expected location and the library hasn't changed, it can do its job much more quickly.
Which means that on a System which does not change much. Libraries stay the same for a long time, something like an Ubuntu LTS/RHEL/CentOS/Debian basically fixed release distros, Prelink will run better and provide great results.
There is only One Caviat.
Prelinking needs to be Scheduled, It needs to run after the Libraries/programs have been upgraded since the libraries are changing. One could achieve that using a simple Cron job or could run it manually once in a while.
So We could techinically combine Preload and Prelink. However prelink is still like a Hack but your mileage may vary. I would give it a shot anyways. If I was on something like Debian or CentOS I would definitely use Preload and Prelink Both.
References for more Information.
http://sysmagazine.com/posts/108454/
https://wiki.archlinux.org/index.php/Preload
https://wiki.archlinux.org/index.php/Prelink

- 214
-
I'll try it now,thanks... I also read something about prelink,should I install it too? – John Doe May 21 '15 at 09:46
-
Yes prelink is a good thing to try, even though I rememeber getting mixed result on firefox. but for other program that gives a good startup boost time. – solsTiCe May 21 '15 at 09:53
-
I would do a bit of research on this because it could potentially case issues if something goes wrong. It does speed up things a little bit. However there is still a chance of breaking your install as you are touching the shared libraries via prelink. – Rajat Pandita May 21 '15 at 10:25
-
so i installed preload,not prelink...and things are pretty much the same... can someone explain me why is that? In every linux distribution i ever used i had a slow app start problem...meanwhile with windows at the same machine programs starts almost immediately... – John Doe May 21 '15 at 11:20
-
Windows is a proprietary Software so Not much is really known as to what it does in the Background. However Linux is different and there are reasons why the Applications load a bit slower. once You know the reasons you may appreciate the design choices. I am going to submit one more answer/Community Wiki around Preload and Prelink and how both can be used to speed up processes. – Rajat Pandita May 22 '15 at 05:29
-
Windows uses a lot of deferred loading so that its desktop is prepared while less visible components wait their turn. Preload invests resources to do the opposite. As an analogy, Windows fully staffs its front desk and other cust. svcs, buying time for inventory/etc. that are spread thinner. Preload moves staff to objectively decrease customers' wait time, but customers have different priorities. Some are on the clock and appreciate every minute they save, maybe for customers of their own; others value their overall experience a little more because it's time that feels well spent. – John P Feb 26 '18 at 02:45
-
I would recommend doing some profiling of your own. Preload won't know your priorities, but Firefox in particular is an unlikely candidate for optimization, because it spends an insignificant amount of time, even during startup, loading libraries vs. its own bulk. You might find instead that your heavyweight applications are competing with processes and services you don't use often or at all (see 'renice', 'init.d', modules to blacklist); get 'powertop', maybe 'nvidia_gpu_top'/equiv., sensors for transfer rates like HDD, and thermal (to see if/when the power manager intervenes.) Happy hunting! – John P Feb 26 '18 at 03:30