Jump to content

Apache settings for high traffic forum


Recommended Posts

Posted

Hello

Can you please recommend me some Apache settings for a high traffic forum with 700 users online per minute so i can handle more users/connections?

I am using also prefork (default settings).

My server:

2x Intel Xeon Quad 5405
16 GB DDR2 RAM

6gb free ram.

My settings:

StartServers 15
MinSpareServers 15
MaxSpareServers 25
ServerLimit 512
MaxClients 384
MaxRequestsPerChild 1000
KeepAlive on
KeepAliveTimeout 3
MaxKeepAliveRequests 100
TimeOut 100

I try also keep alive off and it seems a bit better.

Also i think that i have a limit somewhere as when i have many users is working very fast and then in a few seconds 2-3 is going very slow and then some times down.

I can see when that happend on whm a lot of:

/usr/local/apache/bin/httpd -k start -DSSL

First i was think that it was an attack but was not.

A limit seems to keep the extra connections to wait and this is raising the server load....

Maybe a system limit or Apache limit ....

I was thinking also to try:

StartServers 16
MinSpareServers 16
MaxSpareServers 64
ServerLimit 768
MaxClients 512
MaxRequestsPerChild 100000
KeepAlive On
KeepAliveTimeout 5
MaxKeepAliveRequests 0
Timeout 100

Thank you

Posted

This is what i can see for apache status when i have many users online:



Current Time: Sunday, 06-Mar-2011 22:17:01 EET
Restart Time: Wednesday, 02-Mar-2011 00:41:16 EET
Parent Server Generation: 14
Server uptime: 4 days 21 hours 35 minutes 45 seconds
Total accesses: 4720738 - Total Traffic: 422.0 GB
CPU Usage: u622.74 s40.01 cu0 cs0 - .157% CPU load
11.2 requests/sec - 1.0 MB/second - 93.7 kB/request
6 requests currently being processed, 226 idle workers

____..__._._.______________._____...__.____.__.__.___...__..C_._
____W_..__.____.._.._..____._______...__.___.___.._W._..___.____
._..._.__._____W___.___.__..__.___.____..._.__._.___._.______.__
__.._._._.___.___.__._..___.___._____W_W_.._..____.._____.______
._____...__.__.___.____.._______.___.____________._.__._.__.____
_____.._...__...................................................
................................................................
................................................................

Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process

Keep alive off


I have many waiting and many idle and i don't know if it is normal as with this stats i got a spike on the server load for a few seconds and then is ok.

226 idle workers i think are a lot.

I can see also x3 of these compared with the normal usage after or before a few seconds.


/usr/local/apache/bin/httpd -k start -DSSL


?

Posted

MaxClients and ServerLimit and kinda the same thing and do you have your mysql max_connections set to 384 or more? If not you aren't going to have enough database connections for all of those apache children if/when they get busy. You need to make sure that you have enough resources to go around at max capacity.

You could easily get away with a MaxClients setting of 50 or 75.

Turn KeepAlive off. You are forcing each worker to wait 3 seconds after the last request in case the client decides to send another. This is going to tie up workers which could be servicing other requests from other clients.

Just be glad your web server doesn't look like mine:



top - 10:39:14 up 4 days, 23:44,  1 user,  load average: 32.44, 27.15, 26.83

Tasks: 196 total,  48 running, 146 sleeping,   0 stopped,   2 zombie

Cpu(s): 89.1%us,  8.8%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.2%hi,  1.8%si,  0.0%st

Mem:   6106800k total,  5146556k used,   960244k free,    92656k buffers

Swap:  4063224k total,   107332k used,  3955892k free,  2404492k cached




Current Time: Tuesday, 08-Mar-2011 10:40:11 PST
Restart Time: Monday, 07-Mar-2011 11:50:09 PST
Parent Server Generation: 0
Server uptime: 22 hours 50 minutes 2 seconds
Total accesses: 3102770 - Total Traffic: 23.6 GB
CPU Usage: u1136.31 s88.52 cu.12 cs0 - 1.49% CPU load
37.7 requests/sec - 300.5 kB/second - 8.0 kB/request
67 requests currently being processed, 0 idle workers

WCWWWWWWW.WWWWWCCWW.WWWWWWW.CWWWW.WWWWWWW.WW.CWWWWWWWWWW..WWWWWW
WWWWWWWWWWW

Posted

The limits for sql are:

max_user_connections=500
max_connections=500


I am afraid also that csf firewall is a problem when is looking for the ip's to track the ones with many connections like more than 300 to ban them.

As it sees to use a lot of cpu for that for my 600 users online...

Posted

Turning keep alive off will only cause higher cpu, If your going to use keepalive on set it to around 2, Or if you have plently of memory to spair you can turn this higher, The server will function better the higher it is but then it may consume more memory depending how busy the server is and how tuned the apache is.

Now when you see lots of: /usr/local/apache/bin/httpd -k start -DSSL , That is completly normal, Now if you do put your keepalive on 2, Then you will see less of these !

Any why you allow so many connections via the mysql, That itself will only chew up the memory, see you can have 500 users online at once it does not mean you have to have 500 connections, You can lower that to around 100, It will have no impact on your forum in any single way.

Posted

Any why you allow so many connections via the mysql, That itself will only chew up the memory, see you can have 500 users online at once it does not mean you have to have 500 connections, You can lower that to around 100, It will have no impact on your forum in any single way.




Q: Doesn't MySQL will use memory based on connections?

Example: max_user_connections = 100 but there are only 10 connections. Doesn't that mean that MySQL will use memory for those 10 connections and not 100?
Posted

Any why you allow so many connections via the mysql, That itself will only chew up the memory, see you can have 500 users online at once it does not mean you have to have 500 connections, You can lower that to around 100, It will have no impact on your forum in any single way.



I got an error when i was use 300 that i got the limit and then i raise it up to 500 that cpanel recommends.
Posted

I got an error when i was use 300 that i got the limit and then i raise it up to 500 that cpanel recommends.




Seems that it's keeping the connections open than it normally should, I can only suggest you try and turn off alow_mysql_persistant.

Also max_connections should always be higher than max_user_connections, I don't suggest you keep them the same as your not leaving any room for other processes.
  • 2 weeks later...
Posted

remove all your htaccess files and merge them to your httpd.conf accordingly (if you didn't yet, well you didn't mention ), it'll reduce your server load reasonably.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...