LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   apache high cpu load on high traffic (http://www.linuxquestions.org/questions/linux-newbie-8/apache-high-cpu-load-on-high-traffic-905812/)

awww 09-30-2011 02:57 PM

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

Tinkster 10-02-2011 01:39 AM

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

zackwasa 10-02-2011 03:24 AM

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

sundialsvcs 10-02-2011 08:44 AM

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.

awww 10-03-2011 12:14 AM

this is a screenshot of my htop on a busy day busy ill say 400 people online http://i.imgur.com/q4NW4.png

Tinkster 10-03-2011 02:09 PM

Quote:

Originally Posted by awww (Post 4488584)
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

syg00 10-03-2011 10:25 PM

Quote:

Originally Posted by Tinkster (Post 4488975)
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%.

Tinkster 10-03-2011 10:59 PM

Quote:

Originally Posted by syg00 (Post 4489299)
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

awww 10-04-2011 12:22 AM

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

Tinkster 10-04-2011 03:22 PM

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.


All times are GMT -5. The time now is 01:44 AM.