tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deacon Marcus" <deacon_mar...@wwtech.pl>
Subject RE: Question on HTTPConnector.
Date Sun, 08 Jul 2001 14:33:55 GMT
Hi,

> -----Original Message-----
> From: Craig R. McClanahan [mailto:craigmcc@apache.org]
> Sent: Sunday, July 08, 2001 2:45 AM
> To: tomcat-dev@jakarta.apache.org
> Subject: Re: Question on HTTPConnector.
>
>
> On Sat, 7 Jul 2001 mettu.kumar@redspark.com wrote:
>
> >
> > Looking at org.apache.catalina.connector.http.HTTPConnector I got a
> > question regarding the way its implemented.(I am looking at 4.0b3 src)
> >
> >
> > Look at this block of code(in run method of HTTPConnector):
> > 	    // Hand this socket off to an appropriate processor
> > 	    HttpProcessor processor = createProcessor();
> > 	    if (processor == null) {
> > 		try {
> > 		    log(sm.getString("httpConnector.noProcessor"));
> > 		    socket.close();
> > 		} catch (IOException e) {
> > 		    ;
> > 		}
> > 		continue;
> > 	    }
> >
> > As per my understanding if no. of HTTPConnections == maxProcessors(
> > parameter in server.xml), when a new HTTPRequest comes server just
> > closes the Socket with any wait period.
>
> Yes, that's exactly what happens.
>
> > Isn't this Bad? In cases where
> > Load suddenly increases this could cause problems.
> >
>
> Well yes, it's bad, but so will any other reaction.  What choices are
> there in handling it?
>
> (1) Current behavior of closing the connection and go back to
>     accepting new connections (causes a client-side protocol error)

The best option in my opinion.

> (2) Pause and try again in a bit (but in the mean time, this
>     thread cannot accept any new connections, so they stack up
>     inside the server socket up to acceptCount and then start
>     getting refused)

Now that's BAD :(

> (3) Ignore the maxProcessors parameter and create a new processor (and
>     its associated thread) anyway (can lead to denial of service attacks)

We have maxProcessors so site owner can - and should - tune this himself, if
he really wants (3) he can just set -1.

> Have you a suggestion on how we might deal with this more effectively?
>
> The real key is to configure maxProcessors to the maximum number of
> simultaneous requests you want your server to handle, based on the
> hardware capabilities and the processing requirements of your
> application.  For example, if your response time starts going through the
> roof once you exceed N simultaneous requests (because you've encountered
> some sort of bottleneck), it doesn't make sense to set maxProcessors
> higher than N -- that will just cause response times to slow down for
> everyone.
>
> >
> > Any info on this is greatly appreciated.
> >
> > Thanks,
> > Kumar.
> >
>
> Craig
>

Greetings,
     deacon Marcus


Mime
View raw message