Difference between revisions of "OS: Complete Teori Tuning I/O Performance"

From OnnoWiki
Jump to navigation Jump to search
Line 22: Line 22:
 
dimana SCHEDULER adalah salah satu dari cfq, noop, atau deadline dan DEVICE adalah block device (contoh sda).
 
dimana SCHEDULER adalah salah satu dari cfq, noop, atau deadline dan DEVICE adalah block device (contoh sda).
  
==Available I/O Elevators==
+
==I/O Elevator Yang Tersedia==
  
 
In the following elevators available on openSUSE are listed. Each elevator has a set of tunable parameters, which can be set with the following command:
 
In the following elevators available on openSUSE are listed. Each elevator has a set of tunable parameters, which can be set with the following command:
Line 62: Line 62:
 
===DEADLINE===
 
===DEADLINE===
  
DEADLINE is a latency-oriented I/O scheduler. Each I/O request has got a deadline assigned. Usually, requests are stored in queues (read and write) sorted by sector numbers. The DEADLINE algorithm maintains two additional queues (read and write) where the requests are sorted by deadline. As long as no request has timed out, the “sector” queue is used. If timeouts occur, requests from the “deadline” queue are served until there are no more expired requests. Generally, the algorithm prefers reads over writes.
+
DEADLINE adalah I/O scheduler yang berorientasi pada latency. Setiap I/O reuqest akan diberi deadline. Biasanya, request akan di simpan dalam antrian (read dan write) berdasarkan nomor sector. Algoritma DEADLINE memelihara dua antrian (read dan write) tambahan dimana request di simpan berdasarkan deadline. Selama tidak ada request yang time out, maka antrian "sector" yang akan digunakan. Jika terjadi time out, maka request dari antrian "deadline" akan digunakan sampai tidak adalah request yang habis masanya. Secara umum, algoritma ini lebih menyukai read daripada write.
  
This scheduler can provide a superior throughput over the CFQ I/O scheduler in cases where several threads read and write and fairness is not an issue. For example, for several parallel readers from a SAN and for databases (especially when using “TCQ” disks). The DEADLINE scheduler has the following tunable parameters:
+
Scheduler ini dapat memberikan throughput yang lebih baik daripada CFQ I/O scheduler in cases where several threads read and write and fairness is not an issue. For example, for several parallel readers from a SAN and for databases (especially when using “TCQ” disks). The DEADLINE scheduler has the following tunable parameters:
  
 
/sys/block/<device>/queue/iosched/writes_starved
 
/sys/block/<device>/queue/iosched/writes_starved
Line 76: Line 76:
 
/sys/block/<device>/queue/iosched/write_expire
 
/sys/block/<device>/queue/iosched/write_expire
  
     /sys/block/<device>/queue/iosched/read_expire Sets the deadline (current time plus the read_expire value) for read operations in milliseconds. The default is 500.  
+
     /sys/block/<device>/queue/iosched/read_expire Sets the deadline (current time plus the read_expire value) for read operations in milliseconds. The default is 500.
  
 
==I/O Barrier Tuning==
 
==I/O Barrier Tuning==

Revision as of 05:17, 30 March 2013

Sumber: http://doc.opensuse.org/documentation/html/openSUSE/opensuse-tuning/cha.tuning.io.html


I/O scheduling mengontrol bagaimana operasi input/output akan dikirim ke storage. Linux memberikan berbagai algoritma I/O - disebut elevator - yang cocok untuk berbagai beban kerja. Elevators dapat membantu untuk mengurangi operasi seek (pencarian), dapat memprioritaskan permohonan I/O, dan memastikan permohonan I/O dilakukan sebelum deadline yang diberikan.

Memilih I/O elevator yang terbaik, tidak hanya tergantung pada beban kerja, tapi juga hardwqare. Sebuah disk ATA, SSD, RAID, atau sistem storage di jaringan, masing-masing membutuhkan strategi tuning yang berbeda.

Switching I/O Scheduling

Linux mengijinkan kita untuk menset I/O scheduler default saat boot pertama kali, ini dapat berubah sambil berjalan untuk masing-masing block device (harddisk dll). Hal ini memungkinkan kita untuk mengset algoritma yang berbeda, misalnya untuk, device hosting partisi sistem dan device hosting sebuah database.

Secara default, scheduler CFQ (Completely Fair Queuing) akan digunakan. Ubah default ini dengan cara masuk ke boot parameter

elevator=SCHEDULER

Dimana SCHEDULER adalah salah satu dari cfq, noop, or deadline.

Unuk mengubah elevator dari device yang spesifik dalam sistem yang berjalan, jalankan perintah berikut:

echo SCHEDULER > /sys/block/DEVICE/queue/scheduler

dimana SCHEDULER adalah salah satu dari cfq, noop, atau deadline dan DEVICE adalah block device (contoh sda).

I/O Elevator Yang Tersedia

In the following elevators available on openSUSE are listed. Each elevator has a set of tunable parameters, which can be set with the following command:

echo VALUE > /sys/block/DEVICE/queue/iosched/TUNABLE

where VALUE is the desired value for the TUNABLE and DEVICE the block device.

Untuk mengetahui elevator mana yang saat ini digunakan, jalankan perintah berikut:

cat /sys/block/sda/queue/scheduler

AKan tampak seperti di bawah ini, scheduler yang saat ini digunakan berada dalam kurung siku:

noop [deadline] cfq

CFQ (Completely Fair Queuing)

CFQ is a fairness-oriented scheduler and is used by default on openSUSE. The algorithm assigns each thread a time slice in which it is allowed to submit I/O to disk. This way each thread gets a fair share of I/O throughput. It also allows assigning tasks I/O priorities which are taken into account during scheduling decisions (see man 1 ionice). The CFQ scheduler has the following tunable parameters:

/sys/block/<device>/queue/iosched/slice_idle

   When a task has no more I/O to submit in its time slice, the I/O scheduler waits for a while before scheduling the next thread to improve locality of I/O. For media where locality does not play a big role (SSDs, SANs with lots of disks) setting /sys/block/<device>/queue/iosched/slice_idle to 0 can improve the throughput considerably. 

/sys/block/<device>/queue/iosched/quantum

   This option limits the maximum number of requests that are being processed by the device at once. The default value is 4. For a storage with several disks, this setting can unnecessarily limit parallel processing of requests. Therefore, increasing the value can improve performance although this can cause that the latency of some I/O may be increased due to more requests being buffered inside the storage. When changing this value, you can also consider tuning /sys/block/<device>/queue/iosched/slice_async_rq (the default value is 2) which limits the maximum number of asynchronous requests—usually writing requests—that are submitted in one time slice. 

/sys/block/<device>/queue/iosched/low_latency

   For workloads where the latency of I/O is crucial, setting /sys/block/<device>/queue/iosched/low_latency to 1 can help. 

NOOP

A trivial scheduler that just passes down the I/O that comes to it. Useful for checking whether complex I/O scheduling decisions of other schedulers are not causing I/O performance regressions.

In some cases it can be helpful for devices that do I/O scheduling themselves, as intelligent storage, or devices that do not depend on mechanical movement, like SSDs. Usually, the DEADLINE I/O scheduler is a better choice for these devices, but due to less overhead NOOP may produce better performance on certain workloads.

DEADLINE

DEADLINE adalah I/O scheduler yang berorientasi pada latency. Setiap I/O reuqest akan diberi deadline. Biasanya, request akan di simpan dalam antrian (read dan write) berdasarkan nomor sector. Algoritma DEADLINE memelihara dua antrian (read dan write) tambahan dimana request di simpan berdasarkan deadline. Selama tidak ada request yang time out, maka antrian "sector" yang akan digunakan. Jika terjadi time out, maka request dari antrian "deadline" akan digunakan sampai tidak adalah request yang habis masanya. Secara umum, algoritma ini lebih menyukai read daripada write.

Scheduler ini dapat memberikan throughput yang lebih baik daripada CFQ I/O scheduler in cases where several threads read and write and fairness is not an issue. For example, for several parallel readers from a SAN and for databases (especially when using “TCQ” disks). The DEADLINE scheduler has the following tunable parameters:

/sys/block/<device>/queue/iosched/writes_starved

   Controls how many reads can be sent to disk before it is possible to send writes. A value of 3 means, that three read operations are carried out for one write operation. 

/sys/block/<device>/queue/iosched/read_expire

   Sets the deadline (current time plus the read_expire value) for read operations in milliseconds. The default is 500. 

/sys/block/<device>/queue/iosched/write_expire

   /sys/block/<device>/queue/iosched/read_expire Sets the deadline (current time plus the read_expire value) for read operations in milliseconds. The default is 500.

I/O Barrier Tuning

Most file systems (XFS, ext3, ext4, reiserfs) send write barriers to disk after fsync or during transaction commits. Write barriers enforce proper ordering of writes, making volatile disk write caches safe to use (at some performance penalty). If your disks are battery-backed in one way or another, disabling barriers may safely improve performance.

Sending write barriers can be disabled using the barrier=0 mount option (for ext3, ext4, and reiserfs), or using the nobarrier mount option (for XFS). [Warning]

Disabling barriers when disks cannot guarantee caches are properly written in case of power failure can lead to severe file system corruption and data loss.



Referensi

Pranala Menarik