Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Apr 10, 2009 12:53 am 
Offline
Senior Newbie

Joined: Thu Apr 09, 2009 11:53 pm
Posts: 12
Hello, my linode is Linode 540. Everytime I put one of my wordpress powered sites on it, which has a most user online of 240 and about 9K daily traffic, all things stopped within 5 minutes. The pages wouldn't load but a HTTP 500. Seemed apache shut down. I had to reboot my linode to login via SSH. :cry:
All errors were almost the same:
Code:
WordPress database error MySQL server has gone away for query...

I submitted a ticket. They told me to "tune the Apache MaxClients directive to limit the number of connections". Honestly I do not know how to set that numbers.
In my apache2.conf, it's:
Code:
<IfModule mpm_prefork_module>
    StartServers          16
    MinSpareServers       8
    MaxSpareServers      24
    ServerLimit         400
    MaxClients          200           
    MaxRequestsPerChild   500
</IfModule>

I think it's using prefork mpm (dont know how to check that out).
My control panel is ISPConfig.

I have been too afraid to put that site on my linode. Several months ago I've tried several times then finally I gave up. Now I have to face it. The shared hosting wont allow the site on it any more.
If any body can help me out, it would be so nice and I'm so happy.
Thank you so much!


Top
   
 Post subject:
PostPosted: Fri Apr 10, 2009 5:09 am 
Offline
Senior Member

Joined: Wed Jan 21, 2009 7:13 pm
Posts: 126
Location: Portugal
Try to raise mysql wait_timeout in /etc/mysql/my.cnf
Mine is set to 300.


Top
   
 Post subject:
PostPosted: Fri Apr 10, 2009 9:56 am 
Offline
Senior Newbie

Joined: Thu Apr 09, 2009 11:53 pm
Posts: 12
nfn wrote:
Try to raise mysql wait_timeout in /etc/mysql/my.cnf
Mine is set to 300.

Hi, my MySQL database is not in localhost, it's in another shared hosting. I connected to that database from my Linode.


Top
   
 Post subject:
PostPosted: Fri Apr 10, 2009 10:26 am 
Offline
Senior Member
User avatar

Joined: Sat Oct 16, 2004 11:13 am
Posts: 176
What is happening is that the MySQL server closes the connection - and when PHP tries to access it again, it fails.

Moving MySQL to localhost will probably solve this. Or, you may want to use this workaround: http://robsnotebook.com/wordpress-mysql-gone-away


Top
   
 Post subject:
PostPosted: Fri Apr 10, 2009 10:51 am 
Offline
Senior Newbie

Joined: Thu Apr 09, 2009 11:53 pm
Posts: 12
saman007uk wrote:
What is happening is that the MySQL server closes the connection - and when PHP tries to access it again, it fails.

Moving MySQL to localhost will probably solve this.

But at the same time, my other site which uses localhost MySQL was also down. I think there must be something wrong with apache.


Top
   
PostPosted: Fri Apr 10, 2009 4:32 pm 
Offline
Senior Member
User avatar

Joined: Sun Jan 18, 2009 2:41 pm
Posts: 830
whatness wrote:
I think it's using prefork mpm (dont know how to check that out).

You can do this with the -l option to the Apache server (depending on your system and version, probably either apache2 or httpd).
Code:
# apache2 -l
Compiled in modules:
  core.c
  mod_log_config.c
  mod_logio.c
  prefork.c
  http_core.c
  mod_so.c

On Linux, you'll probably see either prefork.c (the default) or worker.c. I think any others are experimental.


Top
   
PostPosted: Fri Apr 10, 2009 11:25 pm 
Offline
Senior Newbie

Joined: Thu Apr 09, 2009 11:53 pm
Posts: 12
Vance wrote:
You can do this with the -l option to the Apache server (depending on your system and version, probably either apache2 or httpd).

Hi, thanks! It's prefork.c.


Top
   
 Post subject:
PostPosted: Sat Apr 11, 2009 6:54 am 
Offline
Senior Member
User avatar

Joined: Sat Oct 16, 2004 11:13 am
Posts: 176
For word press, there is a work around: http://robsnotebook.com/wordpress-mysql-gone-away

It basically checks that the persistent connection is working before using it.

Also, this does not have anything to do with Apache directly - it is PHP which connects to the MySQl server through the php5-mysql library, not the Apache server itself.


Top
   
PostPosted: Sun Apr 12, 2009 8:36 am 
Offline
Junior Member
User avatar

Joined: Thu Sep 11, 2008 6:46 pm
Posts: 36
Website: http://www.classhelper.org
Location: Atlanta, GA
I use WP Super Cache on my WordPress sites to increase performance, and it has worked really well for me. See the plugin page: http://wordpress.org/extend/plugins/wp-super-cache/

I hope this helps somewhat; the plugin is intended to make sites "Digg-proof." I've withstood a Slashdotting, if that's any indication of its worth.

_________________
Educational resources for parents and teachers: http://www.ClassHelper.org


Top
   
 Post subject:
PostPosted: Sun Apr 19, 2009 2:58 pm 
Offline
Newbie

Joined: Sun Apr 19, 2009 2:56 pm
Posts: 2
AOL: refactorial
Try reducing MaxClients to 35. You should see your performance improve dramatically.


Top
   
 Post subject:
PostPosted: Mon Apr 20, 2009 4:24 am 
Offline
Senior Newbie

Joined: Thu Apr 09, 2009 11:53 pm
Posts: 12
Thank you guys. I bought more RAM, and now things get better. Site down again hours ago when the CPU usage jump to about 400%, and I really don't know what was going on at that moment :shock:


Last edited by whatness on Wed May 20, 2009 11:00 am, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Mon Apr 20, 2009 11:16 am 
Offline
Senior Member
User avatar

Joined: Sat Oct 16, 2004 11:13 am
Posts: 176
cron job?


Top
   
 Post subject:
PostPosted: Mon Apr 20, 2009 5:30 pm 
Offline
Senior Member

Joined: Mon Jun 16, 2008 6:33 pm
Posts: 151
Quote:
Site down again hours ago when the CPU usage jump to about 400%

If you haven't already, install munin (as is posted ad nausium elsewhere ;)).

Or for a quick (?) check, run a cron job every few minutes to append useful stats to a file.


Top
   
 Post subject:
PostPosted: Mon Apr 20, 2009 5:31 pm 
Offline
Junior Member

Joined: Mon Sep 22, 2008 8:41 am
Posts: 48
Location: London, UK
you may want to create a cron script to troublshoot memory/cpu usage. This could be apache/mysql/spamassassin or any other memory demanding application.

Read this first

http://rimuhosting.com/howto/memory.jsp


Top
   
 Post subject:
PostPosted: Mon Apr 20, 2009 10:22 pm 
Offline
Senior Newbie

Joined: Thu Apr 09, 2009 11:53 pm
Posts: 12
refactorial wrote:
Try reducing MaxClients to 35. You should see your performance improve dramatically.

Yay! that works! The site is up for one whole day now.


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


Who is online

Users browsing this forum: No registered users and 3 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:  
RSS

Powered by phpBB® Forum Software © phpBB Group