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.
The second file /proc/stat
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
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()
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.
I/O counter: read syscalls
Attempt to count the number of read I/O operations, i.e. syscalls like read()
I/O counter: write syscalls
Attempt to count the number of write I/O operations, i.e. syscalls like
write() and pwrite().
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.
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 ”
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:
Thank this tool we can be able to confirm i/o problem
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
* * * * * /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 :
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 .