High disk io rate

Hi all,

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

allenwhsu,

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

Hi james,

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.

These are just alerts so you're not in the dark about spikes or irregular amounts of resource usage. You can go into the 'Settings' tab of the Linode Manager and change the threshold for them.

Are you using caching for your site?

Thanks for the response. Yes, I am using WP Super Cache.

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.

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.

~~![](<URL url=)http://i.imgur.com/ryGQ7v1.png" />

Hope this helps clarify what is going with the site. I appreciate your help.~~

That's a lot of Apache's running. It may be worth seeing if you can limit how many processes it's allowed to spawn, or switch to a WWW server that uses very few processes by default.

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 set up and optimized Apache using this Linode guide: https://library.linode.com/hosting-webs … linode-1gb">https://library.linode.com/hosting-website#sph_optimizing-apache-for-a-linode-1gb.

I have a Linode 2GB (Linode 1536), my Apache's configuration file is using the following values:

StartServers 4

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.

Anything you paste on the forum, place between [ code ] and [ /code ] (remove the spaces from those). The code tags will make the forum format it to make it easier to read.

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?

Thank you James and piki for following up this issue. I am new here and I am very impressed by the linode community. Sorry I wasn't able to reply earlier.

             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

Things doesn't go too well so far. I updated the settings from

StartServers 4

MinSpareServers 12

MaxSpareServers 24

MaxClients 60

MaxRequestsPerChild 6000

to

StartServers 5

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?

Your iotop output seems to indicate that Apache processes are swapping; this is bad. Instead of increasing your MaxClients value, you should be reducing it. This will lower Apache's total memory consumption. It's hard to give a recommendation, but as a first cut I'd try 30 and use iotop or some other tool during busy periods to see if swapping is still going on. If not, then you can bump up MaxClients slightly and see what the effect is.

Since you seem to be getting bursts of traffic, I would recommend setting KeepAliveTimeout to 1 second or disabling keepalives completely with KeepAlive Off. Otherwise, visitors may experience excessive delays waiting for your site to load during busy periods.

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.

Hi Vance,

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

@Piki:

bumping up the max clients

So now that you've crashed someone's system, will you stop giving bad advice about things you don't understand? This was the EXACT WRONG THING to do.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct