Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: High disk io rate
PostPosted: Sun Aug 11, 2013 4:46 pm 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
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.

Code:
             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


Last edited by allenwhsu on Tue Aug 13, 2013 10:11 pm, edited 1 time in total.

Top
   
 Post subject: Re: High disk io rate
PostPosted: Sun Aug 11, 2013 5:22 pm 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
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


Top
   
 Post subject: Re: High disk io rate
PostPosted: Sun Aug 11, 2013 5:40 pm 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
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.


Top
   
 Post subject: Re: High disk io rate
PostPosted: Sun Aug 11, 2013 6:25 pm 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
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?


Top
   
 Post subject: Re: High disk io rate
PostPosted: Sun Aug 11, 2013 7:01 pm 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
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.)


Top
   
 Post subject: Re: High disk io rate
PostPosted: Sun Aug 11, 2013 7:47 pm 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
allenwhsu wrote:
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.

_________________
Kris the Piki Geeker


Top
   
 Post subject: Re: High disk io rate
PostPosted: Sun Aug 11, 2013 9:52 pm 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
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

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


Top
   
 Post subject: Re: High disk io rate
PostPosted: Sun Aug 11, 2013 10:04 pm 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
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.

_________________
Kris the Piki Geeker


Top
   
 Post subject: Re: High disk io rate
PostPosted: Sun Aug 11, 2013 11:03 pm 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
I set up and optimized Apache using this Linode guide: https://library.linode.com/hosting-webs ... linode-1gb.

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

<IfModule mpm_prefork_module>
StartServers 4
MinSpareServers 12
MaxSpareServers 24
MaxClients 60
MaxRequestsPerChild 6000
</IfModule>

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.


Top
   
 Post subject: Re: High disk io rate
PostPosted: Mon Aug 12, 2013 10:41 am 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
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.

_________________
Kris the Piki Geeker


Top
   
 Post subject: Re: High disk io rate
PostPosted: Mon Aug 12, 2013 3:03 pm 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
allenwhsu wrote:
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?


Top
   
 Post subject: Re: High disk io rate
PostPosted: Tue Aug 13, 2013 12:36 am 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
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.

Code:
             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.

Code:
             total       used       free     shared    buffers     cached
Mem:          1489       1374        115          0         19        227
-/+ buffers/cache:       1127        361
Swap:          255         12        243


Top
   
 Post subject: Re: High disk io rate
PostPosted: Thu Aug 15, 2013 1:32 am 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
Things doesn't go too well so far. I updated the settings from

<IfModule mpm_prefork_module>
StartServers 4
MinSpareServers 12
MaxSpareServers 24
MaxClients 60
MaxRequestsPerChild 6000
</IfModule>

to

<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 6000
</IfModule>

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?


Top
   
 Post subject: Re: High disk io rate
PostPosted: Fri Aug 16, 2013 7:03 am 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
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.


Top
   
 Post subject: Re: High disk io rate
PostPosted: Sat Aug 17, 2013 9:16 pm 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
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


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
RSS

Powered by phpBB® Forum Software © phpBB Group