High disk io rate
I just moved my wordpress site to Linode two days ago. As someone who has very little coding skill, I am surprised and glad that my site is still alive. However, I occasionally received email notification from Linode when high traffic, like this:
"Your Linode, linodeXXXXXX, has exceeded the notification threshold (1000) for disk io rate by averaging 3298.32 for the last 2 hours."
I found a few past discussions about this issue, realized the following info might help analyzing the issue.
total used free shared buffers cached
Mem: 1525248 1191664 333584 0 37872 468284
-/+ buffers/cache: 685508 839740
Swap: 262140 49164 212976
I also installed iotop and ran it. I got a list with a mostly 0.00s. Occasionally I saw something like:
"29587 be/4 mysql 0.00 B/s 11.64 K/s(this is disk write) 0.00% 0.00% msqld" or
"31144 be/4 www-data 0.00 B/s 3.89 K/s(this is disk write) 0.00% 0.00% apache2 -k start".
These show up fast, I had to took screen caps to capture the numbers. I am assuming there is something wrong with my database?
How can I optimize it? Will this cause any issue to the site?
Thanks in advance!
Allen
15 Replies
I've gotten several of these 'Disk IO' warnings, but I usually get them when I'm doing a lot of copying (backing up sites, uploading new client sites, etc). Did you get the warning for a time period that you were uploading or working on your site, or was it just while the site was running and you weren't doing anything to it?
MSJ
I got these emails when the site receives high amount of traffic, mostly because of some posts being shared on facebook or other socaol networks.
Are you using caching for your site?
Not sure if this helps, but I will run iotop again later when there are more people online and see what I can find (Due to timezone differences, the site receives most of its traffic overnight.)
@allenwhsu:
Thanks for the response. Yes, I am using WP Super Cache.
You could try adding a caching engine, such as Xcache, directly to PHP. If the caching engine allows caching to disk, you can use a tmpfs mount to cache to RAM. That would help reduce disk usage.
~~![](<URL url=)http://i.imgur.com/ryGQ7v1.png
Hope this helps clarify what is going with the site. I appreciate your help.~~
The next process that uses a lot of resources is MySQL. Caching can be used here too, unfortunately I'm no expert at that, so if you need help with this someone else should be able to jump in.
I have a Linode 2GB (Linode 1536), my Apache's configuration file is using the following values:
MinSpareServers 12
MaxSpareServers 24
MaxClients 60
MaxRequestsPerChild 6000
Should I change any value of these? Or maybe other values in the configuration file?
To be honest, I might be showing you something unrelated at all. If that's the case please let me know. Thank you.
This is coming from a non-Apache user, but that doesn't seem very "optimized". Personally I'd be appalled if I needed that many spares with each handling so few connections.
Really, though, you need to experiment on your own to find the optimal settings. I'd recommend starting by bumping down the max spares and bumping up the max clients, and see how that affects performance.
Also enable caching in PHP. There are many cachers out there, such as APC, Xcache, and Zend (the latter being in PHP 5.5), among others. Most of the available cachers allow you to cache to RAM, which will reduce disk usage and improve performance.
Also consider using caching with MySQL, which can also reduce disk usage and improve performance.
@allenwhsu:
So the site started to gain traffic, and I am starting to see some more numbers instead of just 0.00s. I am not sure, but they don't look good I assume.
<__image removed__>
Hope this helps clarify what is going with the site. I appreciate your help.
allenwhsu,
It's been about 24 hours since your original post. Can you grab the output of 'free -m' again? I'd like to see if your swap space usage went up with all that traffic.
Have you hit the busiest hours or days of the week for your site since moving it to Linode? Have you had any performance problems?
total used free shared buffers cached
Mem: 1525248 1109216 416032 0 13952 152452
-/+ buffers/cache: 942812 582436
Swap: 262140 13300 248840
Hi Piki, thanks for the tip, now I am able to display this correctly. Your suggestions are very useful, though I am still trying to understand some of them. I will enable caching in PHP as soon as I can.
Hi James, I did not have any performance problems until earlier. My site just went down for 20 minutes. It is now live again thanks to the Linode support people. I just captured the result of 'free -m', shown as below. This is not the busiest moment but relatively close. I hope it helps. Thanks again for investigating on this.
total used free shared buffers cached
Mem: 1489 1374 115 0 19 227
-/+ buffers/cache: 1127 361
Swap: 255 12 243
MinSpareServers 12
MaxSpareServers 24
MaxClients 60
MaxRequestsPerChild 6000
to
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 6000
I am not sure if this is possible, could be me doing the completely wrong values, but it seems to make things worse. My site went down in no time earlier today when a post got shared on facebook. It went from around 30 people viewing the site to around 180 people viewing it, then it went down. This all happened in about 1-2 minutes.
I saw some posts online saying WP super cache doesn't work will with XCache, does anyone have any comments on this?
Since you seem to be getting bursts of traffic, I would recommend setting KeepAliveTimeout
Edit: I don't have experience with WordPress caches to give any guidance, but discussions seem to indicate they can have a major (positive or negative) effect on performance. Do some searching through the forums here or at WordPress to see what others have experienced.
Thank you for your help! I actually contacted Linode Support, and this is exactly what they told me to do. Reduce the MaxClients (they told me to try 20), and turn off the KeepAlive. After I made the changes, my site is now working fine, and I am not receiving the desk io rate warning anymore as well.
Thank you all for your help!
Allen