Difference between revisions of "OS: Complete Teori Tuning I/O Performance"
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
Line 50: | Line 50: | ||
'''/sys/block/<device>/queue/iosched/slice_idle''' | '''/sys/block/<device>/queue/iosched/slice_idle''' | ||
− | + | Saat sebuah task tidak ada lagi I/O yang masuk pada timeslice-nya, I/O scheduler akan menungggu beberapa saat sebelum menjadwalkan thread selanjutnya untuk memperbaiki lokalitas I/O. Untuk media dimana lokalitas tidak terlalu menentukan (seperti SSD, SAN dengan banyak disk) menset /sys/block/<device>/queue/iosched/slice_idle menjadi 0 akan sangat memperbaiki throughput. | |
'''/sys/block/<device>/queue/iosched/quantum''' | '''/sys/block/<device>/queue/iosched/quantum''' | ||
+ | |||
+ | Pilihan ini akan membatasi request maximum yang akan di proses sebuah device pada satu saat. Nilai default adalah 4. Untuk storage dengan beberapa disk, setting ini akan membatasi request paralel proses. | ||
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. | 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. |
Revision as of 05:39, 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
Elevator berikut tersedia di Linux. Setiap elevator mempunyai parameter yang dapat di tune, yang dapat di set menggunakan perintah berikut:
echo VALUE > /sys/block/DEVICE/queue/iosched/TUNABLE
dimana VALUE adalah nilai yang di inginkan untuk parameter TUNABLE dan blok DEVICE tertentu.
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 adalah scheduler yang berorientasi pada fairness dan digunakan secara default oleh Linux. Melalui algoritma ini setiap thread akan memperoleh pembagian yang adil dari throughput I/O. Algoritma ini juga memungkinkan kita menentukan prioritas task I/O yang akan di perhitungkan saat memutuskan scheduling (lihat man 1 ionice)
-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, lihat perintah
man ionice
Scheduler CFQ mempunyai parameter tuneable berikut:
/sys/block/<device>/queue/iosched/slice_idle
Saat sebuah task tidak ada lagi I/O yang masuk pada timeslice-nya, I/O scheduler akan menungggu beberapa saat sebelum menjadwalkan thread selanjutnya untuk memperbaiki lokalitas I/O. Untuk media dimana lokalitas tidak terlalu menentukan (seperti SSD, SAN dengan banyak disk) menset /sys/block/<device>/queue/iosched/slice_idle menjadi 0 akan sangat memperbaiki throughput.
/sys/block/<device>/queue/iosched/quantum
Pilihan ini akan membatasi request maximum yang akan di proses sebuah device pada satu saat. Nilai default adalah 4. Untuk storage dengan beberapa disk, setting ini akan membatasi request paralel proses.
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
Untuk beban dimana latency I/O menjadi penting, menset /sys/block/<device>/queue/iosched/low_latency ke 1 akan menolong.
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
- http://doc.opensuse.org/documentation/html/openSUSE/opensuse-tuning/book.tuning.html
- http://doc.opensuse.org/documentation/html/openSUSE/opensuse-tuning/cha.tuning.io.html
Pranala Menarik
- Linux
- Ubuntu
- Sistem Operasi
- Kernel
- Compile Kernel
- OS: Linux Kernel
- OS: Parameter Kernel Default
- OS: Kernel Scheduler
- OS: Complete Teori Tuning Kernel Scheduler
- OS: Complete Teori Tuning I/O Performance
- OS: Tuning Kernel Scheduler
- OS: Tuning Completely Fair Queueing CFQ I/O scheduler
- OS: Tuning Completely Fair scheduler CFS
- OS: Build in Monitoring Tool
- Linux Benchmarking
- OS: Benchmarking menggunakan UnixBench
- OS: Benchmarking menggunakan LLCBench
- OS: Membuat Kernel Modul