Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 23rd December 2006, 16:52
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,044
Thanks: 269
Thanked 154 Times in 133 Posts
Default Apache2 tweaking tips?

Yesterday (and today also) one of my Apache2 servers was/is having a real hard time.
Problem is that the site(s) on port 80 get really slow!

Yesterday it had arround 15572 visitors, and today it's allready at 10182 (8 more hours to go for today)
This is only a count for the problem site. The other sites are all low profile.

Only the Apache2 server (on port 80) is slow. SMTP, FTP, SSH and even the Apache on https, port 81 (ISPconfig) and Webmin on https, port 10000 are still fast, so it's not a hardware problem.
Top does also not show a high CPU use on any process!

The "problem" site does NOT make use of any fancy PHP stuff, and does not make use of a MySQL, or .htaccess

So.. I'm 99% sure that it's the Apache2 server!
Is there an easy way to see what parts need tweaking in the Apache2 config file?

Last edited by edge; 23rd December 2006 at 16:55.
Reply With Quote
Sponsored Links
  #2  
Old 23rd December 2006, 19:53
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,044
Thanks: 269
Thanked 154 Times in 133 Posts
Default

Okay.. update..

The page did make some use of "fancy" stuff..
It's using a small loging script that is calling "power phlogger" (from phpee.com)

phlogger is also running on that server, so I guess (1) PHP could not handle phlogger, or (2) MySQL could not handle the amount of data.
(MySQL is also on that server)

Anyway.. After removing the "call to phlogger" from the trouble site, the problem is gone. (To make sure that this was the problem, I added the "call to phlogger" again some time later, and the problem was back again.)

Now I need to see if the problem is the PHP or the MySQL..
Reply With Quote
  #3  
Old 24th December 2006, 01:00
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,044
Thanks: 269
Thanked 154 Times in 133 Posts
Default

Update 2

Guess what.. The problem came back again.. Even with the "phlogger" off

I've now set the MaxClients** in the "/etc/apache2/apache2.conf" a bit higher

**There is two times a MaxClients.
The 1st one was set to 20, and is now set to 40
The 2nd one was set to 150 and is now set to 256

So far so good..
Reply With Quote
  #4  
Old 24th December 2006, 14:45
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,749 Times in 2,579 Posts
Default

Do you use eAccelerator or some other PHP cache? That should lower the load of your server a lot.
Also, did you take a look here? http://www.howtoforge.com/configurin...um_performance

For HowtoForge, we use the following settings for Apache:

Code:
MaxKeepAliveRequests 100000

KeepAliveTimeout 4

<IfModule prefork.c>
ServerLimit            500
StartServers             5
MinSpareServers          5
MaxSpareServers         15
MaxClients             500
MaxRequestsPerChild  100000
</IfModule>
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 24th December 2006, 14:58
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,044
Thanks: 269
Thanked 154 Times in 133 Posts
Default

The page is not using PHP, but it is using Coldfusion (however this it not the problem)

Apache2 is having problems with the (at the moment) 40 connections per second!



I've had a look at the howto, and did all the changesm but it's still having a hard time..
Reply With Quote
  #6  
Old 24th December 2006, 17:04
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,044
Thanks: 269
Thanked 154 Times in 133 Posts
Default

So how do you calculate the MaxClients?

I found the following on the web, but have no clue how to get the "MSRPC".

Quote:
MaxClients can be calculated by the following formula:

MaxClients = (TotalRam - MSRPC) / (MaxProcessSize - MSRPC)

TotalRam - estimated total RAM available to the Apache
MSRPC - Minimal Shared RAM per Child
My TotalRam in the server is 2GB
The CPU (2x) in that server are PIII 1.13GHz (I guess that this is the MaxProcessSize)

Is there a way to see the MSRPC (Minimal Shared RAM per Child)?
Reply With Quote
  #7  
Old 24th December 2006, 21:02
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,263
Thanks: 216
Thanked 649 Times in 295 Posts
Default

Hi Edge,

I do not have an answer for you, but maybe you can find some useful information here: http://modperlbook.org/html/ch11_01.html
__________________
Hans

MrHostman | Managed Hosting
Reply With Quote
  #8  
Old 24th December 2006, 23:25
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,044
Thanks: 269
Thanked 154 Times in 133 Posts
Default

Thanks Hans,

Traffic has gone down a bit (now doing +/- 20 connections per second).
The server is handling this fine for now...
Totall till now (from 09:00 till now 22:25) is 319,905 page views :/

Data used:

1st and 2nd row hour from/to
3rd row data in
4th row data out :/
5th row data totall

Quote:
22:00 - 23:00 89.42 MB 2.27 GB 2.35 GB
21:00 - 22:00 212.21 MB 5.15 GB 5.35 GB
20:00 - 21:00 195.99 MB 4.67 GB 4.87 GB
19:00 - 20:00 226.41 MB 5.56 GB 5.78 GB
18:00 - 19:00 204.30 MB 5.01 GB 5.21 GB
17:00 - 18:00 206.80 MB 4.91 GB 5.11 GB
16:00 - 17:00 339.32 MB 8.87 GB 9.21 GB
15:00 - 16:00 459.85 MB 11.76 GB 12.21 GB
14:00 - 15:00 417.28 MB 9.92 GB 10.33 GB
13:00 - 14:00 415.28 MB 10.06 GB 10.47 GB
12:00 - 13:00 322.61 MB 7.71 GB 8.03 GB
11:00 - 12:00 297.64 MB 6.55 GB 6.84 GB
10:00 - 11:00 203.79 MB 4.32 GB 4.52 GB
09:00 - 10:00 126.69 MB 2.77 GB 2.90 GB

Last edited by edge; 24th December 2006 at 23:30.
Reply With Quote
  #9  
Old 25th December 2006, 13:49
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,749 Times in 2,579 Posts
Default

Quote:
Originally Posted by edge
Is there a way to see the MSRPC (Minimal Shared RAM per Child)?
You can run
Code:
top
to get a feeling how much RAM your Apache children use.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #10  
Old 25th December 2006, 14:27
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,044
Thanks: 269
Thanked 154 Times in 133 Posts
 
Default

Falko,

top is alsway confusing me..

This is what I get when I ask top to show me only www-data.

Code:
top - 13:13:57 up 9 days, 17:44,  1 user,  load average: 0.10, 0.17, 0.12
Tasks: 292 total,   1 running, 291 sleeping,   0 stopped,   0 zombie
 Cpu0 :  1.2% us,  0.7% sy,  0.0% ni, 97.2% id,  0.0% wa,  0.2% hi,  0.7% si
 Cpu1 :  1.4% us,  0.7% sy,  0.0% ni, 97.0% id,  0.0% wa,  0.2% hi,  0.7% si
Mem:   3636872k total,  2694140k used,   942732k free,    83472k buffers
Swap:  2650684k total,        0k used,  2650684k free,  2206836k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 6547 www-data  16   0 24300  11m  19m S  0.2  0.3   0:00.08 apache2
...
...
many more, but all with 0.3 for %MEM
...
Is it the %MEM I should look at (0.3)?

Also.. It's now nice and quite again on the server..

Here are the stats from yesterday.
Small note.. This server has got only ONE site with ONE page on it.
(I have moved every other site that was running on that server temporarily to an other server the day before)
The page views might look low, but the server was really having a hard time from 10:00 to 12:00. After this I "tweaked" the Apache2 server, and it did work a bit better..




Total page views from 09:00 to 09:00 (24 hrs) 371,715
Busiest time of the day was from 15:00 to 16:00 hrs with 74536 pages (that is about 1242 pages per minute)

After "tweaking" Apache at 12:00 it worked nice the rest of the day

The bandwidth used for that day was in 4.28 GB, and out 100.48 GB (again, this is only one site with one page and some flash on it)

I think I'm okay now as the Christmas rush is over, but I would still like to get Apache2 setup correct (for the next time)

Last edited by edge; 25th December 2006 at 14:31.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SSI with Apache2 on Debian jchaven Server Operation 7 25th August 2008 18:06
Apache2 without APXS ctroyp Installation/Configuration 8 29th January 2007 04:05
Web server offline after php4 and apache2 upgrade dfriis Installation/Configuration 11 7th December 2006 17:14
PHP on Apache2 no longer works after ISPconfig azorman Installation/Configuration 6 23rd July 2006 23:06
looking for howto tweaking apache2 Ovidiu Server Operation 2 23rd November 2005 00:24


All times are GMT +2. The time now is 09:47.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.