To squeeze as much performance as possible from your Linux server, learn how to change the I/O scheduler to suit your needs.
Linux I/O SchedulerControls the way the kernel submits read and write requests to the disk. Since the 2.6 kernel, administrators have been able to change this scheduler so they can customize their platform to exactly suit their needs.
There are three schedulers to choose from, each with its own advantages. These schedulers are:
This is probably one of the things you do when you want to get the best out of your Linux machine. Fortunately, changing the I/O scheduler is very simple. Let me tell you how.
Find out which scheduler you haveThe first thing you need to do is find out which scheduler is handling the I/O on your system. This is done from the command line, you must know the name of the disk. For simplicity, I'll assume the disk is sda. Based on this information, open a terminal window and enter the following command:
cat /sys/block/sda/queue/scheduler
The results of this command will display the currently running scheduler (picture below).
Elementary OS Loki runs the deadline scheduler.
Change your schedulerYou can change your scheduler in two ways: immediately or permanently. If you change the scheduler on the fly, it will revert to the previous default scheduler after reboot. You may want to make on-the-fly changes first to see which scheduler gives you the best performance for your needs.
Speaking of your immediate need to change to the noop scheduler. To do this, enter the following command:
sudo echo noop > /sys/block/hda/queue/scheduler
You can changenooptocfqordeadline.
This change can take effect without restarting the computer. Once changed, the I/O scheduler will switch and (hopefully) you will see a performance improvement (again, depending on your needs).
If you want to change the scheduler to be permanent, you must do this in the GRUB configuration file. To do this, entersudo nano /etc/default/gruband modify the following lines:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
arrive
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"
Again, you can changenoopto whatever scheduler you need. If you are using on-the-fly modification, you do not have to restart for the new scheduler to take effect.
These are the methods to modify the scheduler.
Make a wise choiceYou should do your research to find out what scheduler is best for your particular situation. To learn more about each scheduler, check out these wiki pages: CFS, Noop, and Deadline.
The above is the detailed content of One way to improve server performance: Modify the Linux I/O scheduler. For more information, please follow other related articles on the PHP Chinese website!