Reduce apache memory load.

tino

Verified User
Joined
Jan 8, 2004
Messages
92
Hi,

I've set all my setting in httpd.conf according to the threads I found here. Apache still takes up about all memory.

The server is handeling A LOT of traffic; about 5000GB/month

I need to tighten the memory usage on apache.

Anyone got great tips?

Tino
 
Five terrabytes of traffic a month?

How much memory?

What's the output of your top command when httpd is busy?

Jeff
 
Yes, 5000GB of web traffic per month.

The server has 1GB of memory.

Here's a top 2 minutes after a reboot. It's sorted by memory usage. Normally, the server load will reach somewhere between 12 and 18.

22:55:49 up 1:08, 1 user, load average: 5.64, 2.59, 3.28
216 processes: 215 sleeping, 1 running, 0 zombie, 0 stopped
CPU states: 2.5% user 6.2% system 0.0% nice 0.0% iowait 91.2% idle
Mem: 1030936k av, 1021356k used, 9580k free, 0k shrd, 89740k buff
808628k actv, 59312k in_d, 21072k in_c
Swap: 2047744k av, 26584k used, 2021160k free 736444k cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
9609 apache 15 0 20328 12M 3308 S 0.0 1.2 0:01 0 httpd
9623 apache 15 0 20620 12M 3104 S 0.0 1.2 0:01 0 httpd
9596 apache 15 0 19456 11M 3448 S 0.0 1.1 0:00 0 httpd
9569 apache 15 0 19028 10M 3260 S 0.0 1.0 0:00 0 httpd
9598 apache 15 0 20412 10M 2900 S 0.0 1.0 0:01 0 httpd
9655 apache 15 0 18724 10M 3156 S 0.0 1.0 0:00 0 httpd
9543 apache 15 0 14068 6072 3076 S 0.0 0.5 0:00 0 httpd
9580 apache 15 0 13848 6028 2908 S 0.0 0.5 0:00 0 httpd
9528 apache 15 0 14008 5684 2880 S 0.0 0.5 0:00 0 httpd
9591 apache 15 0 14352 5648 2892 S 0.0 0.5 0:00 0 httpd
9558 apache 15 0 13836 5604 2720 S 0.0 0.5 0:00 0 httpd
9614 apache 15 0 14244 5572 3256 S 0.0 0.5 0:00 0 httpd
9512 apache 15 0 13880 5564 2888 S 0.0 0.5 0:00 0 httpd
9657 apache 15 0 13884 5540 2764 S 0.0 0.5 0:00 0 httpd
9597 apache 15 0 13984 5372 2536 S 0.0 0.5 0:00 0 httpd
9645 apache 15 0 13692 5312 2728 S 0.0 0.5 0:00 0 httpd
9584 apache 15 0 13980 5256 2948 S 0.0 0.5 0:00 0 httpd
9588 apache 15 0 13968 5228 2976 S 0.0 0.5 0:00 0 httpd
9643 apache 15 0 13572 5132 2652 S 0.7 0.4 0:00 0 httpd
9531 apache 15 0 13608 5000 2684 S 0.0 0.4 0:00 0 httpd
9556 apache 15 0 13412 4980 2488 S 0.3 0.4 0:00 0 httpd
9576 apache 15 0 13820 4940 2828 S 0.0 0.4 0:00 0 httpd
9592 apache 15 0 13680 4876 2676 S 0.0 0.4 0:00 0 httpd
9644 apache 15 0 13812 4860 2872 S 0.3 0.4 0:00 0 httpd
9562 apache 15 0 13600 4852 2480 S 0.0 0.4 0:00 0 httpd
9616 apache 15 0 13764 4848 2772 S 0.0 0.4 0:00 0 httpd
9518 apache 15 0 13572 4840 2652 S 0.0 0.4 0:00 0 httpd
9632 apache 15 0 13812 4836 2876 S 0.3 0.4 0:00 0 httpd
9534 apache 15 0 13860 4832 2864 S 0.0 0.4 0:00 0 httpd
9542 apache 15 0 13604 4820 2680 S 0.0 0.4 0:00 0 httpd
9639 apache 15 0 13708 4804 2672 S 0.0 0.4 0:00 0 httpd
9629 apache 15 0 13676 4800 2752 S 0.0 0.4 0:00 0 httpd
9656 apache 15 0 13780 4784 2792 S 0.0 0.4 0:00 0 httpd
9573 apache 15 0 13564 4776 2624 S 0.0 0.4 0:00 0 httpd
9630 apache 15 0 13616 4744 2620 S 0.0 0.4 0:00 0 httpd
9589 apache 15 0 13616 4708 2692 S 0.0 0.4 0:00 0 httpd
9550 apache 15 0 13688 4696 2764 S 0.0 0.4 0:00 0 httpd
9574 apache 15 0 13560 4684 2640 S 0.3 0.4 0:00 0 httpd


Tino
 
The httpd processes you're showing appear to use about 20% of memory. Are there a lot more httpd processes you're not showing us?

The percentage of memory returned by the top of the top command isn't unusual at all; by default unix and Linux will use almost all of the available memory, managing it for fastest memory access to processes that need it.

You don't mention your processor speed, but my guess is you running your server near processor capacity; your average bandwidth (not data transfer, which some people mis-describe as bandwidth) is about 15 mbps, and that's a lot.

Other issues may be:

1) Your connectivity provider may be shaping your traffic (some do that without telling you), so processes are kept open longer than they need to be, as they send traffic more slowly than they otherwise might.

2) Your outbound bandwidth may have high latency, which will cause the same problem.

3) Your drives may be causing a bottleneck, which will cause the same problems.

If I were moving that much traffic on any given server I'd want multiple Xeon processors and a high-performance RAID array.

Jeff
 
Well, this is only the very top of the top command. THe list with apache processes goes on and on...

Yes, the server is on a 15mbit connection (100% full all the time)

So there no apache tuning I can do?!

Tino
 
I believe you're maxing out your connection, and processes are lining up and waiting to be able to deliver their webcontent and recycle themselves to accept another request.

You can tune the httpd daemon to not allow so many connections, which will allow your server more resources for email, etc., but it will slow down your http response even further.

Oh, we should all have such successful sites.

:)

Jeff
 
:)

Yes, it's a site for one of my customers. He's consuming the whole server. I could just deinstall DA on that server. :) He's got the only site on that machine!


Tino
 
Hopefully he's paying enough for it; I sure hope you're not one of those guys selling unlimited bandwidth for $6.95 per month :) .

You never did write about your processor or drive specs, but anything over 1 Ghz speed shouldn't have any problems with a 15 mbps connection line. My guess is that bandwidth is the limitation.

The usual thought among hosting companies and ISPs is that once you're averaging close to 70% of bandwidth you should be buying more or your clients are going to see slowdowns.

Jeff
 
Well, we do charge more the enough for his account. But we're not even making a profit out of it. This kind of traffic is really expensive.

I won't list any prices, otherwise it could be interpreted as advertising...

I have another server, Dual Xeon 2.4, 4GB RAM, 3x143GB U320 SCSI RAID... doing 500GB traffic/month.

I really should swap those two servers. :)

Tino
 
Here's a top 2 minutes after a reboot. It's sorted by memory usage. Normally, the server load will reach somewhere between 12 and 18.


What about after 2 hours??
 
Back
Top