i've noticed cloud hosting solutions have poor disk io. causes few problems solved having script wait until disk less busy.
with php possible monitor busy (or not busy) state of filesystem without making things worse?
if linux system, can calculate disk usage - language choose implement in use same concepts.
your kernel using sysfs makes lot of information system available @ /sys
; can grab information our desired disks @ regular interval, , calculate usage based on differences between them.
on system looking @ disk, sda
, yours may differ.
$ cat /sys/class/block/sda/stat 42632 25 2045318 247192 6956543 7362278 123236256 23878974 0 3703033 24119492
now if @ the kernel documentation /sys/class/block/<dev>/stat
can see following descriptions each column of output.
name units description ---- ----- ----------- read i/os requests number of read i/os processed read merges requests number of read i/os merged in-queue i/o read sectors sectors number of sectors read read ticks milliseconds total wait time read requests write i/os requests number of write i/os processed write merges requests number of write i/os merged in-queue i/o write sectors sectors number of sectors written write ticks milliseconds total wait time write requests in_flight requests number of i/os in flight io_ticks milliseconds total time block device has been active time_in_queue milliseconds total wait time requests
if run on cron schedule, , diff of wait times, can see how long waiting on each operation. have other stats total iops, , rw bandwidth. documentation goes more in depth on each field.
whatever language chosen, file descriptor open information disk be
/sys/class/block/<dev>/stat
if on schedule, can draw fancy graphs ;)
Comments
Post a Comment