Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

So I've been trying to figure out this disk IO problem I have been having with my linode VPS. Over the last day or two I've just left

watch -n1 pidstat -d 

running in a console window and the output looks like this:

pidstat output

Monitoring it over the last few days, I've noticed that my problem lies with the init, searchd, and mysql processes. Searchd is sphinx and all its indexes are on disk, so disk io there is inevitable (apparently).

What I can't understand is why the disk reads (kB_rd/s) for mysql refuse to stabilize and just keep going up. It started out at 154 yesterday and is up to what you see in that screen shot. but disk writes (kB_wr/s) have remained pretty constant the entire time.

My VPS only has 768MB RAM, my mysql db has a size of about 220MB and after running mysqltuner.pl and reading a bit about it, I've been advised to set my innodb_buffer_pool_size to 220MB but I simply cannot afford to do that ... I have it up to 150MB.

My question is twofold.

Why does the init process have that much disk reading to do?

Why is mysql doing so much disk reading?

share|improve this question
2  
You consider 733 KB / second "much"? It would of course depend on your load if it looks like much or not, but a simple full table scan of a larger table in MySQL might cause higher I/O load than this. –  the-wabbit Aug 31 '12 at 7:45
    
BTW: consider using iotop instead of pidstat -d, it is able to provide some interesting further information on I/O happening (especially stats on process memory is being swapped in/out). –  the-wabbit Aug 31 '12 at 7:52
    
I wouldn't really consider it high if it were it bursts, but it just seems to be constant. but I'm not familiar with the way pidstat is tallying up those read/write numbers so I don't know (thats what I'd like to find out). Thanks for the iotop recommendation I was already aware of this and using it to help figure out the issue. the key swappers were mysql and passenger instances. Which again points to mysql as the culprit. –  trustfundbaby Aug 31 '12 at 8:07
    
the other thing is that the high number of reads by searchd alluded to with pidstat doesn't seem to be borne out by iotop -a. searchd doesn't show up in the list of processes that have any kind of disk io going when I run iotop cl.ly/image/1n0O3V1C0C23 ... I guess I need to better understand what exactly pidstat is presenting to me as data –  trustfundbaby Aug 31 '12 at 8:54
1  
My bet is that your queries are requiring full table scans. –  David Schwartz Aug 31 '12 at 12:16

1 Answer 1

up vote 0 down vote accepted

Disabling the query cache based on this http://mysql.rjweb.org/doc.php/memory (Query cache section) and increasing innodb_buffer_pool size to 200MB solved the problem. Disk IO is under control but my vps now uses up a lot more swap than it did before (30-40MB vs 10-20MB) ... oddly enough the swap is being used by passenger application instances not mysql.

share|improve this answer

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.