I/O SEEKERS


Many users rent VPS  but sometimes there exist limits I/0  on disks.I show you To not fall how to protect himself from extra cost trap I/O .

First use vmstat

vmstat is a great tool for fast analyzing  usage ram swap cpu and I/O . To many I/O operations is always reasons for analysis system.
Screenshot from 2017-04-03 07-06-38

The second file  /proc/stat

Screenshot from 2017-04-03 07-10-04

5th column of cpu is a number I/O operations waiting for complete greenmark.

Red mark procs_blocked show number of processes currently blocked, (can be blocked by waiting for i/o resources )

Step    third “everything is file”

In Linux everything is file . You can analyze use any process looking top /proc/[pid]/io .

This is nice method for check how many io connsupt process  processes

Screenshot from 2017-04-03 07-26-34
rchar
I/O counter: chars read
The number of bytes which this task has caused to be read from storage. This
is simply the sum of bytes which this process passed to read() and pread()

wchar
I/O counter: chars written
The number of bytes which this task has caused, or shall cause to be written
to disk. Similar caveats apply here as with rchar.
syscr
I/O counter: read syscalls
Attempt to count the number of read I/O operations, i.e. syscalls like read()
and pread().
syscw
I/O counter: write syscalls
Attempt to count the number of write I/O operations, i.e. syscalls like
write() and pwrite().
read_bytes
I/O counter: bytes read
Attempt to count the number of bytes which this process really did cause to
be fetched from the storage layer. Done at the submit_bio() level, so it is
accurate for block-backed filesystems. write_bytes
I/O counter: bytes written
Attempt to count the number of bytes which this process caused to be sent to
the storage layer. This is done at page-dirtying time.
cancelled_write_bytes
The big inaccuracy here is truncate. If a process writes 1MB to a file and
then deletes the file, it will in fact perform no writeout. But it will have
been accounted as having caused 1MB of write.

How to make small investigation

“Example in aws or azure webpannel we have information server using 70% i/o resources ”

Sar

First step w can use sar is great  tool  collect many important information .Can display all system statistic example i/o bandwidth read and write by disk . Is not very precisely data but enough for start diagnose

Install sar in Fedora 25.
dnf install sysstat-11.3.5-1.fc25.x86_64

You can also install from sources:
https://github.com/sysstat/sysstat 

Thank this tool we can be able to confirm i/o  problem

iotop

IOTOP is great tool displays columns for the I/O bandwidth read and written by each process/thread during the sampling period

You can download form repository or form sources https://github.com/Tomas-M/iotop 

Create trap

crontab -e

* * * * *  /usr/sbin/iotop -botqqqk –iter=60 | grep -P “\d\d\.\d\d K/s” >> /var/log/iodata.log
Analyzing data from iotop

Log output iotop from few hours is huge and total human unreadable so I created a simple script for present nice plot r and showing data by time and process name.

hash  lines ” set xrange” or  provide correct range time . 

Example outputs from script :

Screenshot from 2017-04-17 13-17-12

io_ios20-21

Thanks script we able to se with one process eating  most  i/o  this si find process and python process between 8:54 and 9:06 every day .

 

Bibliography

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/proc.txt?id=HEAD#l1305  – section 3.3

https://github.com/sysstat/sysstat

https://www.linux.com/blog/monitor-disk-io-linux-server-iotop-and-cron

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s