LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-30-2011, 01:57 PM   #1
awww
Member
 
Registered: Nov 2010
Posts: 38

Rep: Reputation: Disabled
apache high cpu load on high traffic


i have a Intel Quad Core Xeon X3440 (4 x 2.53GHz, 8MB Cache, Hyper Threaded) with 16gig and 1tb harddrive with a 1gb port and my apache is causing my cpu to go up to 100% on all four cores heres my http.config

<IfModule prefork.c>
StartServers 10
MinSpareServers 10
MaxSpareServers 15
ServerLimit 1000
MaxClients 1000
MaxRequestsPerChild 5000
</IfModule>

<IfModule worker.c>
StartServers 35
MaxClients 200
MinSpareThreads 30
MaxSpareThreads 305
ThreadsPerChild 255
MaxRequestsPerChild 0
</IfModule>

KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 800

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 2
 
Old 10-02-2011, 12:39 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Can you post the output of top for the machine in a busy time period,
preferably w/ threads turned on(man top; /threads)?


Cheers,
Tink
 
Old 10-02-2011, 02:24 AM   #3
zackwasa
Member
 
Registered: Sep 2011
Posts: 52

Rep: Reputation: Disabled
Are your websites using PHP? Most likely you have some bad php script or someone abuses it.

You can also check the active connections to apache using mod_status to see whatever is running at the time of the high cpu usage

RMI

Last edited by zackwasa; 01-12-2012 at 01:10 AM.
 
Old 10-02-2011, 07:44 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 11,151
Blog Entries: 4

Rep: Reputation: 4105Reputation: 4105Reputation: 4105Reputation: 4105Reputation: 4105Reputation: 4105Reputation: 4105Reputation: 4105Reputation: 4105Reputation: 4105Reputation: 4105
Certainly, Apache most often uses trivial amounts of CPU. You have a very capacious machine. Look at the Apache logs for any clues as to what the requests might be asking Apache to do.
 
Old 10-02-2011, 11:14 PM   #5
awww
Member
 
Registered: Nov 2010
Posts: 38

Original Poster
Rep: Reputation: Disabled
this is a screenshot of my htop on a busy day busy ill say 400 people online http://i.imgur.com/q4NW4.png
 
Old 10-03-2011, 01:09 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by awww View Post
this is a screenshot of my htop on a busy day busy ill say 400 people online http://i.imgur.com/q4NW4.png
Looking at that shot (of htop's output, which doesn't show iowait)
I'd say the CPUs are bored out of their tree on each individual task,
and I'll hazard the guess that the I/O subsystem of your MySQL
database is the bottleneck in this scenario. What exactly ARE you
running on the machine, what is the hard-disk subsystem (controller
type, how many disks, which raid level,...)?



Cheers,
Tink
 
Old 10-03-2011, 09:25 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,365

Rep: Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190Reputation: 4190
Quote:
Originally Posted by Tinkster View Post
I'd say the CPUs are bored out of their tree on each individual task,
Say what ?. They're all running flat out - mainly userspace code.
I wonder if the sort has been inverted. @awww hit F4 to check the sort of the CPU%.
 
Old 10-03-2011, 09:59 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by syg00 View Post
Say what ?. They're all running flat out - mainly userspace code.
I wonder if the sort has been inverted. @awww hit F4 to check the sort of the CPU%.
Sorry, wasn't specific; not a single task was sitting at high CPU;
and yes, I didn't consider a reversed sort order - that wouldn't
make too much sense imho. Unfortunately the ntop shot doesn't
show "waits", which is what I suspect will be high on the box.


Cheers,
Tink
 
Old 10-03-2011, 11:22 PM   #9
awww
Member
 
Registered: Nov 2010
Posts: 38

Original Poster
Rep: Reputation: Disabled
im running 2 websites from this server 1 tubesite and 1 vb forum this is a screenshot of my iostat http://i.imgur.com/lo0DW.png heres my serever metrics currently 200 people online http://i.imgur.com/2LgbU.png and my htop http://i.imgur.com/fcBhd.png
 
Old 10-04-2011, 02:22 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Sorry, but those all look like they're taken at different times, and
none of these have a load that gets close to what your first shot
showed us. For future reference: can you please, instead of using
screenshots on an external site just copy & paste the text into code-blocks?
Makes life so much easier and quicker for people willing to help you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] High CPU load, but low CPU usage (high idle CPU) baffy Linux - Newbie 5 03-13-2013 09:24 AM
High load and high cpu kernel usage enid Linux - Server 8 09-30-2010 03:33 AM
[SOLVED] High CPU load on I/O operation ack_iix Slackware 8 08-08-2009 06:13 AM
high cpu utilization under heavy traffic load electron707 Linux - Security 4 01-13-2005 08:59 AM
Why am I getting ?high? CPU load? pnh73 Linux - General 15 10-21-2003 10:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration