Hi,
I have a quite loaded webserver, the CPU is very low and memory usage is also low, but sometimes the page doesn't respond...

Here's the info on my system:

FreeBSD 7.1 amd64
1x Q9550 (quad core)
8Gb RAM

top
------
last pid: 13453; load averages: 0.09, 0.08, 0.07 up 3+04:04:03 00:34:56
306 processes: 1 running, 304 sleeping, 1 zombie
CPU: 0.3% user, 0.0% nice, 0.2% system, 0.0% interrupt, 99.5% idle
Mem: 666M Active, 1746M Inact, 545M Wired, 84K Cache, 214M Buf, 4957M Free
Swap: 4096M Total, 4096M Free

PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND
97616 root 1 44 0 181M 22084K select 0 0:14 0.00% httpd
516 root 1 44 0 5688K 1376K select 0 0:07 0.00% syslogd
652 root 1 44 0 10696K 4120K select 0 0:03 0.00% sendmail
11084 www 1 44 0 183M 25556K select 0 0:02 0.00% httpd
641 root 1 44 0 22876K 3904K select 3 0:01 0.00% sshd
11977 www 1 44 0 183M 25432K select 0 0:01 0.00% httpd
95731 root 1 44 0 33768K 4688K select 0 0:01 0.00% sshd
12203 www 1 44 0 183M 25344K select 0 0:01 0.00% httpd
95408 root 1 44 0 33768K 4688K select 0 0:01 0.00% sshd
12354 www 1 44 0 183M 25884K select 3 0:01 0.00% httpd
95391 root 1 44 0 33768K 4688K select 1 0:01 0.00% sshd
12419 www 1 44 0 182M 25104K select 0 0:01 0.00% httpd
12437 www 1 44 0 182M 25204K select 2 0:01 0.00% httpd
12468 www 1 44 0 183M 25788K select 0 0:01 0.00% httpd
12479 www 1 44 0 183M 25208K select 3 0:01 0.00% httpd
12453 www 1 44 0 183M 25224K select 2 0:01 0.00% httpd
12478 www 1 44 0 183M 25304K select 0 0:01 0.00% httpd
12617 www 1 44 0 183M 25284K select 3 0:00 0.00% httpd
12550 www 1 44 0 183M 25164K select 0 0:00 0.00% httpd
12529 www 1 44 0 182M 25252K select 0 0:00 0.00% httpd
12621 www 1 44 0 182M 25308K select 0 0:00 0.00% httpd
12694 www 1 44 0 182M 25148K select 0 0:00 0.00% httpd
12680 www 1 44 0 182M 25124K select 2 0:00 0.00% httpd
12650 www 1 44 0 182M 25060K select 0 0:00 0.00% httpd
12730 www 1 44 0 183M 25152K select 3 0:00 0.00% httpd
12698 www 1 44 0 183M 25476K select 0 0:00 0.00% httpd
12708 www 1 4 0 183M 25536K accept 0 0:00 0.00% httpd
12665 www 1 44 0 182M 25028K select 3 0:00 0.00% httpd
12809 www 1 44 0 183M 25312K select 0 0:00 0.00% httpd
12787 www 1 44 0 182M 25072K select 0 0:00 0.00% httpd
12798 www 1 44 0 182M 25116K select 0 0:00 0.00% httpd
12788 www 1 44 0 183M 25440K select 3 0:00 0.00% httpd
12752 www 1 44 0 182M 25208K select 0 0:00 0.00% httpd
12852 www 1 44 0 183M 25092K select 2 0:00 0.00% httpd
12794 www 1 44 0 182M 25172K select 3 0:00 0.00% httpd
12866 www 1 44 0 183M 25088K select 2 0:00 0.00% httpd
662 root 1 8 0 6744K 1440K nanslp 0 0:00 0.00% cron
12760 www 1 44 0 183M 25500K select 0 0:00 0.00% httpd
12754 www 1 44 0 182M 25216K select 0 0:00 0.00% httpd
12833 www 1 44 0 182M 25080K select 3 0:00 0.00% httpd
12907 www 1 44 0 182M 25296K select 3 0:00 0.00% httpd
12864 www 1 44 0 182M 25072K select 0 0:00 0.00% httpd
12842 www 1 44 0 182M 25232K select 0 0:00 0.00% httpd
12816 www 1 44 0 183M 25264K select 0 0:00 0.00% httpd
12925 www 1 44 0 182M 25008K select 3 0:00 0.00% httpd
12800 www 1 44 0 182M 25056K select 2 0:00 0.00% httpd
12948 www 1 44 0 183M 25696K select 0 0:00 0.00% httpd
12914 www 1 44 0 182M 25208K select 0 0:00 0.00% httpd
12911 www 1 44 0 182M 24876K select 0 0:00 0.00% httpd
12904 www 1 44 0 183M 25100K select 0 0:00 0.00% httpd
12944 www 1 44 0 183M 25180K select 1 0:00 0.00% httpd
13029 www 1 44 0 182M 25316K select 3 0:00 0.00% httpd
......many more httpd processes ....truncated.....

How can it be to have 5Gb of RAM free? each apache process uses almost 26Mb and there are 300 processes so ....26Mbx300processes= 7800Mb (the system have 8Gb)??


My hhtpd.conf (relevant lines) as follows:
Timeout 20
KeepAlive On
MaxKeepAliveRequests 0
KeepAliveTimeout 15
MinSpareServers 16
MaxSpareServers 64
StartServers 16
ServerLimit 512
MaxClients 512
MaxRequestsPerChild 10000

do you recommend me any changes? why the CPU and memory is not fully used...and why the server is not responding sometimes with so low load?

Thanks for your help

Hmmm... did u try using the default Apache settings.

For example Redhat recommends Maxclients not to exceed 256.

KeepAlive setting is ON, but the number of MaxKeepAliveRequests is 0???

I would recommend you to try the default settings first and then tune the parameters later for optimizing performance.

Good Luck....

Usually, the apache logs are pretty good about telling you when they have resource problems. The system can still have 5GB of ram free, because most of those apache processes are using 'shared memory' from the parent, which isn't directly allocated to them. You can use some tuning utilities like mtrace if you want specific information on what it's allocating, but I would venture to guess that at 300 processes at the time of the output, that your likely hitting some hard limitation in the apache configuration when it times out.

The 256 limit for Maxclients and ServerLimit are just defaults, and for a server that is already at 300+ processes, would definitely lead to more issues if it were to be lowered.

MaxClients translates into the maximum number of child processes that will be launched to serve requests, as such, just lowering this value just killed over 40 daemons he's *already* using to service requests. If they have the resources to support it (which the above output tends to lead to) then it should be safe to keep that limit where it is.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.