Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Jan 04, 2014 4:31 pm 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
Hello,

My website (onefunnyjoke.com) is running slow lately when it receives high traffic, it even went offline sometimes (clouldfare error 522 or 524). My site was able to handle traffic more than this, but a recent website refresh seemed to weaken the website.

I upsized my linode from 1GB to 2GB, but no luck. I installed "htop" with my very little back-end knowledge, and I am seeing lots of processes using around 50% CPU under "user/sbin/apache2", and the user is mostly "www-data". However, I could not further understand the meaning behind this. How can I find the culprit, for example, which script or function is slowing down the site?

If needed, I reconfigured my PHP with "memory_limit = 256M", and for Appache:
Code:
StartServers 4
MinSpareServers 12
MaxSpareServers 24
MaxClients 20
MaxRequestsPerChild 6000

However, with the same settings, the site performed better before the website refresh.

I am one single front-end developer who is trying to manage a website with heavy traffic. Any comments would be greatly appreciated!

Allen


Top
   
PostPosted: Sat Jan 04, 2014 7:50 pm 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
allenwhsu,
What do you mean by when you say "a recent website refresh"? What did you update? WP? Plugins? Both? Something else?

What does your RAM usage look like? What do you get when you run 'free -m' from the command line (without the quotes).


MSJ


Top
   
PostPosted: Sun Jan 05, 2014 4:13 pm 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
Sorry James, a lot happened since this post. My site is down now, once I get it back I will provide all the information.

Thanks,

Allen


Top
   
PostPosted: Sun Jan 05, 2014 5:37 pm 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
OK...It's back now. It was down because the lack of disk space, causing it somehow emptied files when I tried to do some updates. What a fun way to start a year.

A recent website refresh (did not install any new plugins):

1. Based on the "Wordpress Popular Posts" Plugin that I have been using for a long time, I added one more list of popular posts (6) at the bottom of each post. Not sure if doubles the burden for the site.

2. Added 2 more random posts in sidebar in each post (no plugin used).

3. Changed a list of recent posts in a carousel to a list of random posts, all pages (no plugin used).

4. Added a mailchimp newsletter signup form, all pages (no plugin used).

5. Added one more Google adsense ad in each post (no plugin used).

6. Other font size, image size changes in CSS.

This is what I got from 'free -m':

Code:
             total       used       free     shared    buffers     cached
Mem:          1491       1371        119          0         36        501
-/+ buffers/cache:        834        657
Swap:          255          0        255

(very little traffic now after the downtime)

Not sure if this help...Again, as a one man team handling a site that probably requires a team of developers, I really appreciate your help.

Allen


Top
   
PostPosted: Mon Jan 06, 2014 12:07 am 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
Allen,
Your site seems to be working fine at the moment. Are you still having problems with it?


MSJ


Top
   
PostPosted: Mon Jan 06, 2014 2:29 am 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
Thanks for getting back to me.

I can tell the problem still reminds. It is taking long time to load pages when the traffic gets a bit heavy. I disabled #1 and #3 (from my previous post), but no luck.

I have to work tomorrow, but if you have any suggestions, please let me know. I will further investigate this issue.

Thanks so much,

Allen


Top
   
PostPosted: Mon Jan 06, 2014 11:32 am 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
Allen,
Are you using a WordPress cache module? If not you should try one.

Have you taken a look at your Longview history? The 30 minute snapshot should be helpful if you are seeing this problem in real time.

Also htop & iotop are very helpful tool to determine what may be using your system resources. If you don't have htop or iotop you can install them with:
Code:
apt-get install htop
apt-get install iotop


MSJ


Top
   
PostPosted: Tue Jan 07, 2014 12:54 am 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
Yes, I am using a cache plugin.

Longview history: It requires me to install things on my server. I will wait until I have more time, just in case anything goes wrong. However, I checked Google Analytics' server response time, it gave me more clue on when might be the point everything goes down. I made some updates and hopefully it helps (site is still very slow now, but I am blaming on caches).

I have tried htop and iotop, and I did see huge CPU and disk usage, but the result is beyond my knowledge. All I know is it has something to do with Apache.


Top
   
PostPosted: Wed Jan 08, 2014 1:18 am 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
The site is still either slow or give you a timeout error.

I captured a screenshots of htop and iotop results. Although I can't understand, results in htop look like hell to me. If anyone can help me understand the data, that would be extremely helpful.

Image

Allen


Top
   
PostPosted: Wed Jan 08, 2014 3:45 am 
Offline
Senior Member
User avatar

Joined: Wed Mar 17, 2004 4:11 pm
Posts: 554
Website: http://www.unixtastic.com
Location: Europe
Total guesswork but apache's mod_rewrite can use lots of CPU.
Set the site to default permalinks and comment out mod_rewrite. That may reduce the CPU usage but you loose the pretty permalinks.


Top
   
PostPosted: Wed Jan 08, 2014 11:08 am 
Offline
Senior Member

Joined: Sun May 23, 2010 1:57 pm
Posts: 315
Website: http://www.jebblue.net
This might be useful:

http://www.howtogeek.com/howto/ubuntu/m ... apachetop/


Top
   
PostPosted: Fri Jan 10, 2014 12:52 am 
Offline
Junior Member

Joined: Fri Aug 09, 2013 8:58 pm
Posts: 33
Thanks you guys. My site have been using "pretty permalinks" for years, so I am excluding this as a culprit for now.

I have installed Longview, and I am seeing:
Code:
Name ▲   User   Max #   Avg IO   Avg CPU   Avg Mem
▸apache2   www-data   20   217 KB/s   605%   762 MB

I know this is a long shot, but can any one tell me that this apache2 could possibly be?

Allen


Top
   
PostPosted: Fri Jan 10, 2014 8:56 am 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
The apache2 processes are your web server processes.

Have you contacted support and asked them if they have any insight to this?


Top
   
PostPosted: Fri Jan 10, 2014 11:14 am 
Offline
Senior Member

Joined: Sun May 23, 2010 1:57 pm
Posts: 315
Website: http://www.jebblue.net
Main Street James wrote:
The apache2 processes are your web server processes.

Have you contacted support and asked them if they have any insight to this?


I wonder if apachetop might help him.


Top
   
PostPosted: Sun Jan 12, 2014 3:21 am 
Offline
Senior Newbie

Joined: Fri Jan 03, 2014 6:21 pm
Posts: 8
I would do some Apache log analysis. Look for a URL that is being hit repeatedly or and IP address or addresses that are hitting the site repeatedly to start with. Something is making your Apache/PHP stack work really hard.

robert


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


Who is online

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