Readahead accelerates Linux boot

Source: Internet
Author: User
Readahead accelerates Linux boot speed-general Linux technology-Linux technology and application information. For more information, see the following. A year or two ago, when the Linux core still lacks a good hard drive pre-read mechanism, if users of the desktop system want to speed up the boot, they usually have to solve the boot bottleneck problem first. Therefore, you must rely on tools such as readahead to pre-load the files you want to read, so as to speed up system loading.

The basic principle of readahead is to first load the files that may be used during the boot process to the memory (page cache ). In this way, the startup speed can be accelerated by saving time for reading files.

Of course, the premise is that you have enough memory for caching. If your system only has small memory, we do not recommend using readahead. currently, the versions used in Ubuntu and Debian GNU/Linux are based on Erich Schubert and Robin H. johnson and Scott James Remnant are modified from Gentoo. The Fedora Project has the same concept but is developed by RedHat.

The following describes the Ubuntu and Debian GNU/Linux versions.

In order for readahead to correctly cache the files required for boot, you must teach readahead how many files need to be preloaded. In principle, you only need to do this once. When Ubuntu releases the official version, it will create a set of pre-tuned file lists. However, if you update the core or suite system every time, especially the programs required for starting the system, you should actually perform a "profile" operation so that readahead can properly load the file list.

Compared with the Debian readahead instruction file, the old version of Ubuntu is still used, which is quite mysterious. debian only reminds you that readahead cannot be used on NFS. If you forget to describe how to use it. On Ubuntu, readahead checks whether the profile parameter exists in/proc/cmdline. If yes, it performs profiling. If Grub is used, perform the following operations:

When you see the "GRUB loading" prompt, press the "Esc" Key
Press the "e" key to edit it. (If multiple cores exist, select the default boot core line)
Press the "down" Key to the "kernel" Line
Select the "e" key for editing.
You will enter the parameter editing mode, move to the parameter, and add "profile", "profile" to the end, remember to fill in the blank.
Press Enter to complete editing.
Press "B" to start the instance.

It takes a little longer to start the system for the first time, but after a profile is created, the boot speed should be improved.

In Debian, you only need to use root to issue the following command and restart the system.

# Touch/etc/readahead/profile-once

However, in the new version of Linux, there are technical support such as On-demand read-ahead. Such a tool is not particularly needed and may even slow down the boot time.

Try to test (kernel 2.6.24-16-generic) on the asus eeepc 701 with Ubuntu Eee installed, and test the uptime when the software is installed on the desktop by default, every time it takes about 60 s. It takes about 80 seconds for the profile to be performed, and the boot speed of the profiled readahead is the same.

In addition, I also tested Thinkpad X60 1706-B69. The software is the Debian sid and the core is 2.6.26-1-686. The system is equipped with a lot of miscellaneous software, hardware is equipped with 2 GB memory, hard drive is 8 M Buffer, 5400RPM of the FUJITSU MHV2100B. Profile uses about 152 s, profiled readahead is about 55 s, and readahead is about 53 s.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.