Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a virtual machine with a php based application (in apache) on it, when looking at disk activity there is a constant 170kbps write when apache is running.

When we apply load then the performance of the server is cpu bound but this seems to be directly related to disk write IO jumps of 20-30x. The CPU usage graph mirrors the write disk access graph.

Any ideas?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Two recommendations:

iotop is a handy program that shows you real-time I/O usage in a format like the top command. This should help you identify the script/binary thats doing all the I/O. I think this may already be installed on newer kernels, but yum may provide it on RHEL if you don't see it.

lsof is also helpful with I/O troubleshooting; it lists any open files.

UPDATE

If there is "constant" disk activity, then iotop should tell you which process(es) are the culprits. Regarding I/O transaction history: I don't believe IO history is logged anywhere in most Linux distros, but you can add a cron job.

As root, open up crontab with crontab -e and add these two lines:

* * * * * /bin/date >> /var/log/iotop; /usr/local/bin/iotop -bot --iter=3 -q >> /var/log/iotop
* * * * * /bin/date >> /var/log/lsof; /usr/bin/lsof -b -w >> /var/log/lsof

That dumps iotop and lsof output to a log every minute. Add a logrotate script for each to keep the files from taking up all your space, e.g.:

someuser@myhost:~> cat /etc/logrotate.d/lsof
/var/log/lsof {
  rotate 3
  weekly
  compress
  missingok
  notifempty
}
share|improve this answer
    
I think lsof is what I want, I'll try it to see if it shows me the open files. Is there anyway to get a tail of io operations including deletes? –  JTew May 28 '12 at 20:43
    
Looks like you figured it out, but I added some info the my answer if you find it helpful. –  Banjer May 29 '12 at 12:41

It appears that an unrelated background task was deleting the contents of the /tmp directory where php was being pre-compiled to. As a result the php pre-compile process started again resulting in constant disk activity.

share|improve this answer
    
was the background task a custom cron job you created or something by default in RHEL 6? –  Banjer May 29 '12 at 12:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.