Re: 2 questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Feb 6, 2007, at 3:45 PM, Geoff Hartman wrote:

Q1: Is there any way to optimize apache for the highest number of possible connections?

Your main tunable is the MaxClients directive, which you can tune to maximize the number of workers Apache will have available. You should tune this always in relation to your available RAM (so your server never has to resort to virtual memory during operation) and available CPU cores. More than several hundred worker threads or processes per CPU core can be counterproductive and do you more harm than good!

In general, it is best to have Apache take care of process management, and use MaxClients as the absolute highest number.

Because TCP connection sockets are handled by the kernel, even the MaxClients number is not an absolute upper limit. Connections can back up in the kernel to a limit that could be determined by the ListenBacklog directive.

If you don't need to listen on multiple IP addresses or listening ports, make sure you don't have more than one Listen statement in your configuration file. This causes Apache to operate without an accept() mutes, which may make it more efficient on certain platforms.

See the httpd documentation: http://httpd.apache.org/docs/2.2/ and/or attend my Performance Tuning sessions at ApacheCon Europe 2007, May 1-4 in Amsterdam.

Q2: I seem to have a high number of active connections with a state of TIME_WAIT when I run netstat. Is that bad? or normal?

Yes, this is normal. The operating system places sockets in TIME_WAIT for a certain period of time (usually two minutes) after the server has completed a three-way TCP closure handshake. Various operating systems (you don't tell us what you're using) have different ways of tuning kernel limits related to how many connections it'll keep around and for how long.

If your site is so busy that you run out of resources on your server, you need more servers to spread the load. I also talk about this at ApacheCon.

S.

--
sctemme@xxxxxxxxxx            http://www.temme.net/sander/
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF


Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux