You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Geoff Hartman <ge...@fivepack.net> on 2007/02/07 00:45:15 UTC

[users@httpd] 2 questions

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

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?

Thanks!

Re: [users@httpd] 2 questions

Posted by Geoff Hartman <ge...@fivepack.net>.
Thanks!

----- Original Message ----- 
From: "Joshua Slive" <jo...@slive.ca>
To: <us...@httpd.apache.org>
Sent: Tuesday, February 06, 2007 4:05 PM
Subject: Re: [users@httpd] 2 questions


> On 2/6/07, Geoff Hartman <ge...@fivepack.net> wrote:
>>
>>
>> Q1: Is there any way to optimize apache for the highest number of 
>> possible
>> connections?
>
> Yes.
>
> But how to do it is really dependent on your specific setup and needs.
> If you really only care about number of connections and not
> throughput, then you just need tons of memory and a threaded mpm.  For
> general advice, start with:
> http://httpd.apache.org/docs/2.2/misc/perf-tuning.html
>
> Then if you need more help, try to come back with more specific questions.
>
>>
>> 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?
>
> Normal.  It isn't anything to worry about unless you start getting
> connections refused even though you have idle apache processes.
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] 2 questions

Posted by Joshua Slive <jo...@slive.ca>.
On 2/6/07, Geoff Hartman <ge...@fivepack.net> wrote:
>
>
> Q1: Is there any way to optimize apache for the highest number of possible
> connections?

Yes.

But how to do it is really dependent on your specific setup and needs.
 If you really only care about number of connections and not
throughput, then you just need tons of memory and a threaded mpm.  For
general advice, start with:
http://httpd.apache.org/docs/2.2/misc/perf-tuning.html

Then if you need more help, try to come back with more specific questions.

>
> 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?

Normal.  It isn't anything to worry about unless you start getting
connections refused even though you have idle apache processes.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] 2 questions

Posted by Steven Pierce <pa...@speakeasy.net>.

*********** REPLY SEPARATOR  ***********

On 2/6/2007 at 4:11 PM Sander Temme wrote:

>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.

I have seen his talks and they are good..  You should try to attend the
next apachecon, it will give you a lot of very good info on how Apache
works.  Also you get to meet some of the people that work on the
project.




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] 2 questions

Posted by Sander Temme <sc...@apache.org>.
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@apache.org            http://www.temme.net/sander/
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF