Home> System Tutorial> LINUX> body text

One way to improve server performance: Modify the Linux I/O scheduler

WBOY
Release: 2024-01-15 22:42:06
forward
1229 people have browsed it

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 调度器来改善服务器性能

Linux I/O Scheduler()Controls 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:

  • CFQ(Completely Fair Scheduler())(cfq): It is a feature of many Linux distributions The default scheduler for Windows version; it places synchronization requests submitted by processes into multiple process queues, and then allocates a time slice to each queue to access disk.
  • Noop scheduler (noop): The simplest I/O scheduler in the Linux kernel based on the first-in-first-out (FIFO) queue concept. This scheduler works best with SSDs.
  • Deadline scheduler (deadline): Try to guarantee the start service time of the request.

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 have

The 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
Copy after login

The results of this command will display the currently running scheduler (picture below).

更改 Linux I/O 调度器来改善服务器性能

Elementary OS Loki runs the deadline scheduler.

Change your scheduler

You 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
Copy after login

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"
Copy after login

arrive

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=noop"
Copy after login

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 choice

You 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!

source:linuxprobe.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!