Mafi kyawun Kayan aiki don Kula da Ayyukan I/O Disk a cikin Linux


Taƙaice: A cikin wannan jagorar, za mu tattauna mafi kyawun kayan aiki don saka idanu da kuma gyara ayyukan I/O diski (aiki) akan sabar Linux.

Mahimmin ma'auni na aiki don saka idanu akan uwar garken Linux shine ayyukan I/O (shigarwa/fitarwa), wanda zai iya tasiri sosai ga bangarori da yawa na uwar garken Linux, musamman saurin adanawa zuwa ko dawo da su daga faifai, na fayiloli ko bayanai (musamman). a kan sabobin bayanai). Wannan yana da tasirin tasiri akan ayyukan aikace-aikace da ayyuka.

1. iostat - Yana Nuna Input na Na'ura da Ƙididdiga na Fitarwa

kayan aikin saka idanu na tsarin a cikin kunshin sysstat, wanda shine kayan aikin da aka yi amfani da shi sosai da aka tsara don ba da rahoton ƙididdigar CPU da ƙididdigar I/O don toshe na'urori da ɓangarori.

Don amfani da iostat akan uwar garken Linux ɗin ku, kuna buƙatar shigar da kunshin sysstat akan tsarin Linux ɗinku ta hanyar aiwatar da umarni mai dacewa don rarraba Linux ɗinku.

$ sudo apt install sysstat          [On Debian, Ubuntu and Mint]
$ sudo yum install sysstat          [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a app-admin/sysstat  [On Gentoo Linux]
$ sudo apk add sysstat              [On Alpine Linux]
$ sudo pacman -S sysstat            [On Arch Linux]
$ sudo zypper install sysstat       [On OpenSUSE]    

Don nuna sauƙin rahoton amfani da na'ura, gudanar da iostat tare da zaɓin layin umarni -d. Yawancin lokaci, rahoton farko yana ba da ƙididdiga game da lokaci tun lokacin farawa na tsarin (lokacin taya) kuma kowane rahoto na gaba yana damuwa da lokaci tun rahoton da ya gabata.

Yi amfani da -x don ƙarin rahoton ƙididdiga da alamar -t don ba da lokaci ga kowane rahoto. Bayan haka, Idan kuna son kawar da na'urori ba tare da wani aiki ba a cikin fitar da rahoton, ƙara alamar -z:

# iostat -d -t 
OR
# iostat -d -x -t 

Don nuna ƙididdiga a cikin kilobytes a sakan daya sabanin toshewa a sakan daya ƙara alamar -k, ko amfani da tutar -m don nuna ƙididdiga a megabytes a sakan daya.

# iostat -d -k
OR
# iostat -d -m

iostat kuma na iya nuna ci gaba da rahotanni na na'ura a x tazara na biyu. Misali, umarni mai zuwa yana nuna rahotanni a tazarar daƙiƙa biyu:

# iostat -d 2

Mai alaƙa da umarnin da ya gabata, zaku iya nuna n adadin rahotanni a tazarar x na biyu. Umurni mai zuwa zai nuna rahotanni 10 a tazarar dakika biyu. A madadin, zaku iya ajiye rahoton zuwa fayil don bincike na gaba:

# iostat -d 2 10
OR
# iostat -d 2 10 > disk_io_report.txt &

Don ƙarin bayani game da ginshiƙan rahoton, karanta shafin iostat man:

# man iostat

2. sar - Nuna Ayyukan Tsarin Linux

sar wani abu ne mai amfani wanda ke jigilar kaya tare da kunshin sysstat, wanda aka yi niyya don tattarawa, rahoto, ko adana bayanan ayyukan tsarin. Kafin ka fara amfani da shi, kana buƙatar saita shi kamar haka.

Da farko, kunna shi don tattara bayanai a cikin fayil ɗin /etc/default/sysstat.

# vi /etc/default/sysstat

Nemo layi na gaba kuma canza ƙimar zuwa gaskiya kamar yadda aka nuna.

ENABLED="true"

Na gaba, kuna buƙatar rage tazarar tattara bayanai da aka ayyana a cikin ayyukan sysstat cron. Ta hanyar tsoho, ana saita shi zuwa kowane minti 10, zaku iya rage shi zuwa kowane minti 2.

Kuna iya yin wannan a cikin fayil ɗin /etc/cron.d/sysstat:

# vi /etc/cron.d/sysstat

Ajiye fayil ɗin kuma rufe shi.

A ƙarshe, kunna kuma fara sabis na sysstat ta amfani da umarnin systemctl mai zuwa:

# systemctl enable --now sysstat.service
# systemctl enable sysstat.service

Bayan haka, jira tsawon mintuna 2 don fara duba rahotannin sar. Yi amfani da umarnin sar da zaɓin layin umarni na -b don ba da rahoton I/O da kididdigar ƙimar canja wurin da -d don ba da rahoton ayyuka ga kowace na'urar toshe kamar yadda aka nuna.

# sar -d -b

3. iotop – Kula da Linux Disk I/O Amfani

Mai kama da iotop shine mai sauƙin amfani wanda ke ba ku damar saka idanu ayyukan I/O diski da amfani akan kowane tsari.

Kuna iya shigar da shi akan uwar garken Linux ɗinku kamar haka (tuna don gudanar da umarnin da ya dace don rarraba Linux ɗin ku):

$ sudo apt install iotop             [On Debian, Ubuntu and Mint]
$ sudo yum install iotop             [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a sys-processs/iotop  [On Gentoo Linux]
$ sudo apk add iotop                 [On Alpine Linux]
$ sudo pacman -S iotop               [On Arch Linux]
$ sudo zypper install iotop          [On OpenSUSE]    

Don saka idanu akan ayyukan I/O na kowane tsari, zaku iya gudanar da iotop ba tare da wata gardama ba kamar haka. Ta hanyar tsoho, jinkiri tsakanin maimaitawa shine 1 seconds. Kuna iya canza wannan ta amfani da alamar -d.

# iotop
OR
# iotop -d 2

iotop ta tsohuwa zai nuna duk zaren tsari. Don canza wannan ɗabi'a ta yadda kawai ya nuna matakai, yi amfani da zaɓin layin umarni -P.

# iotop -P

Hakanan, ta amfani da zaɓi na -a, zaku iya umurce shi don nuna I/O da aka tara sabanin nuna bandwidth. A cikin wannan yanayin, iotop yana nuna adadin ayyukan I/O da aka yi tun lokacin da aka kira iotop.

# iotop -P -a

Abin da muke da shi ke nan a gare ku! Muna so mu san tunanin ku game da wannan jagorar ko kayan aikin da ke sama. Bar tsokaci ta hanyar amsa tambayoyin da ke ƙasa.

Za ku kuma iya sanar da mu game da kayan aikin da kuke tunanin sun ɓace a cikin wannan jeri, amma sun cancanci bayyana a nan.