logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: How to troubleshoot raging apache cpu and memory?
Author
Zulan



Joined: 02 Nov 2006
Posts: 6

PostPosted: Thu 02 Nov '06 17:10    Post subject: How to troubleshoot raging apache cpu and memory? Reply with quote

Hi!

I have an apache server on a windows 2003 server, running all the lastest versions as of today regarding mysql, php and apache. This is because I thought an upgrade could help. But it didnt. My problem is that about 15 seconds after I start apache Mysql takes about 70% of the cpu and apache 30%. Then apache just eats memory until the server crashes, giving me virutal mem errors and that kind of stuff.

I have tried removing my site from htdocs to see if it was my site but that didn't help. I have also removed the servers internet access to see if I was under attack or something weird like that, but that didn't help. How can find out what's causing this? How can I troubleshoot it? Where can I see what apache is doing?

Please help!
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Thu 02 Nov '06 18:26    Post subject: Reply with quote

How much memory is in that server? How much GHz has the CPU?
What did you change in the httpd.conf and or PHP.ini and or my.ini from MySQL
Back to top
Brian



Joined: 21 Oct 2005
Posts: 209
Location: Puyallup, WA USA

PostPosted: Thu 02 Nov '06 20:33    Post subject: Reply with quote

along with cpu, speed, ram, is there I/O activity to Apache and/or MySQL?

Does this occur after a PHP request is made?

Does it occur no matter what with no page request, no PHP page requests and so on?

For example, if you disable networking, and simply enable the MySQL and Apache services, and the box sits idle with no network connections, thus no activity in and out of MySQL and Apache, what happens?

If you have no page requests, if you have no MySQL connections and it goes crazy, then it paints one pictue which is quite different than if it is dying under a load, even a small load.
Back to top
Zulan



Joined: 02 Nov 2006
Posts: 6

PostPosted: Thu 02 Nov '06 20:55    Post subject: Reply with quote

Hello again!

Thanks for your answeres, I really appreciate it.

The server have 768mb ram and a 3.2 Ghz Intel CPU. I haven't made any changes to httpd.conf, php.ini or my.ini. I did however do an upgrade to the latest wordpress release yesterday, but after that it worked just fine and that upgrade shouldn't do any changes to these files mentioned. Since I have tested the server with no files in htdocs I don't think the wordpress upgrade has anything to do with it.

There seems to be activity between apache and mysql since if I check mysql with mysql administrator it shows alot of activity.

I'm not sure if it's before or after a php request, how can I tell?

There might have been page requests since most of the testing have been while the server was "online". I will remove all the files again, remove internet access for the server and try again to see if it works.

I noticed this error message in the event viewer, might just be caused by timeouts though:

Faulting application httpd.exe, version 2.2.3.0, faulting module libapr-1.dll, version 1.2.7.0, fault address 0x00008249.

_____________________________________

Well, I tested it out and it seems to be calm as long as there is no page requests. Don't know why I had the same problem with empty htdocs before, since now everything is fine as long as I dont use wordpress. So this most likely has something to do with the upgrade I did yesterday.
Back to top
pnllan



Joined: 05 Dec 2005
Posts: 221

PostPosted: Thu 02 Nov '06 21:17    Post subject: Reply with quote

I'm not saying that what I'm about to say is the problem, but it potentially can effect performance (especially on Dual Channel Memory Architecture):

786 MB is a rather odd configuration, most likely aggregated from using two chips of different capacity. Doing something this has multiple pitfalls. Namely, speed mismatches (RAS, CAS, Latch Timing, etc...) due to the design of each piece or stick (often determined by SPD). On a low capacity system, this usually is not observed, but the higher the capacity (CPU Speed and CPU Loading) the more problematic it becomes. Most IO chipsets that have been released the last few years are primarily designed to run Dual Channel Memory, but run Single Channel as well though with diminished performance.

What version of Apache are you using?

Where did you get the version you are using?
Back to top
Zulan



Joined: 02 Nov 2006
Posts: 6

PostPosted: Thu 02 Nov '06 21:30    Post subject: Reply with quote

Acutally, the server is a virtual server using latest vmware server on a dualcore 3.2 ghz server with 2gb ram. The host is absolutely idle.

I've been running this configuration for well over a year with no problems.

I'm using the lastest version of apache, 2.2.3 downloaded today from apache website, the version with an installer.
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3058
Location: Hilversum, NL, EU

PostPosted: Thu 02 Nov '06 22:17    Post subject: Reply with quote

This kind of hogging memory is mostly a php issue or a php extension. And when you run Apache as module, then when php screws up then php pulls also Apache down. You upgraded Wordpress only, so maybe they do things diffrent with php/mysql as before.

Btw. I did not know that "dualcore 3.2 ghz" is out for more then a year, otr I misread you.

pnllan: my dev box has also 768mb, that's 3 sticks of 256 Mb memory

Steffen
Back to top
Zulan



Joined: 02 Nov 2006
Posts: 6

PostPosted: Thu 02 Nov '06 22:20    Post subject: Reply with quote

Thanks again for your help!

It turned out the wordpress database got screwed somewhere. After restoring from a few days back it's now working fine.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Fri 03 Nov '06 11:35    Post subject: Reply with quote

I had the same problem with typ03. It uses some zend functions heavyly
and after that memory will not be freed again Neutral
Back to top
mhilliard



Joined: 04 Sep 2007
Posts: 9
Location: Mn-USA

PostPosted: Tue 04 Sep '07 2:56    Post subject: Memory loss by Windows and Apache 2.x Reply with quote

james,
We have been getting a common error where our Windows 2003 server With Apache 2.x and PHP 5.x keeps consuming memory until the apache web server stops serving pages. Typically we see the httpd.exe. or Apache.exe (dependingon what version of Apache we are using) go up to 3-400 MB of RAM used.

Did anyone ever find out what was causing this problem?

Mark H. Mn. USA

James Blond wrote:
I had the same problem with typ03. It uses some zend functions heavyly
and after that memory will not be freed again Neutral
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Tue 04 Sep '07 9:50    Post subject: Reply with quote

On heavy PHP action, I recommend to use PHP as fastcgi with a short live circle to free the resources.
Since PHP 5.2.3 you can use memory_limit in php.ini for Windows. Second thing is to optimize SQL queries ^^ To join(t)s slow down.
For me it helped to count the time for each execution. A lot of work. But now my applications run better.
Back to top


Reply to topic   Topic: How to troubleshoot raging apache cpu and memory? View previous topic :: View next topic
Post new topic   Forum Index -> Apache