You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rumpa Giri <rg...@healthfusion.com> on 2010/06/28 22:06:31 UTC

questions on documentation for configuring AJP connector

We are currently using - 

 

Tomcat - 5.5.25

JDK 1.5

IIS 6

Windows XP 64bit and 32bit machines

 

We are trying to upgrade to the latest connector. While going through the
worker properties variables to set we have few questions regarding the
following -

 

1) connection_pool_size - 

 

>> Usually this is the same as the number of threads per web server process.
(cut-paste from the description for connection_pool_size)

 

I am not familiar with IIS - so how do you determine the above?

 

>> You should measure how many connections you need during peak activity
without performance problems, and then add some percentage depending on your
growth rate.

 

How do you determine what is a good percentage?

 

Also does this property have any correlation with the attribute MaxThreads
in the <Connector> tag of server.xml? How do you determine what value should
you put for MaxThreads?

 

2) connection_pool_timeout - The server.xml - the default value if not
specified explicitly is 60000(60 secs). I see in our server.xml AJP
connector tag - its not specified - which means I do need to specify this
property connection_pool_timeout in our worker.properties as 60? The
documentation says the default for connection_pool_timeout is 0, shouldn't
it be 60 if this has to be in synch with server.xml?

 

3) The worker.loadbalancer.method property - currently not set - but we are
thinking of doing as B instead of default R. What do you use in general? Is
there a disadvantage to switching from Request to Busyness?

 

4) Question on server.xml -

 

maxSpareThreads 

maxThreads 

minSpareThreads 

 

What are the criteria to select appropriate values? For production servers -
how do you determine the values to set?

Is there a correlation between the values for above(maxSpareThreads,
maxThreads, minSpareThreads)

 - for example - does the maxSpareThreads have to be certain % of
maxThreads?

 

Thank you for reading the question.

 

Regard,

Rumpa Giri


Re: questions on documentation for configuring AJP connector

Posted by Rainer Jung <ra...@kippdata.de>.
On 28.06.2010 22:06, Rumpa Giri wrote:

> We are trying to upgrade to the latest connector. While going through the
> worker properties variables to set we have few questions regarding the
> following -

Please do also grab the source tarball. In version 1.2.30 it contains an 
example configuration file that has a lot of helpful comments in it.

> 1) connection_pool_size -
>
>
>
>>> Usually this is the same as the number of threads per web server process.
> (cut-paste from the description for connection_pool_size)
>
>
>
> I am not familiar with IIS - so how do you determine the above?

There was some debate, whether there's a way to automatically determine 
that. Microsoft doesn't really document it and it seems to depend a lot 
on IIS version and windows details. See also André's comments.

> Also does this property have any correlation with the attribute MaxThreads
> in the<Connector>  tag of server.xml? How do you determine what value should
> you put for MaxThreads?

If there is only one Tomcat you are forwarding to, then it would be the 
same number. Tomcat - without the tcnative/APR connector - uses one 
thread per incoming connection.

Things get more complicated, if you start using IIS with multiple 
processes, or a farm of several Tomcats.

> 2) connection_pool_timeout - The server.xml - the default value if not
> specified explicitly is 60000(60 secs). I see in our server.xml AJP
> connector tag - its not specified - which means I do need to specify this
> property connection_pool_timeout in our worker.properties as 60? The
> documentation says the default for connection_pool_timeout is 0, shouldn't
> it be 60 if this has to be in synch with server.xml?

It should be in sync (apart form the fact that one is in seconds and the 
other in milliseconds) and you should expliciteley set both. See the 
commented example config in the 1.2.30 source download.

> 3) The worker.loadbalancer.method property - currently not set - but we are
> thinking of doing as B instead of default R. What do you use in general? Is
> there a disadvantage to switching from Request to Busyness?

https://issues.apache.org/bugzilla/show_bug.cgi?id=44454

R should be good enough in most cases, except things like many parallel 
and long running requests, e.g. download farms for huge content.

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: questions on documentation for configuring AJP connector

Posted by Rumpa Giri <rg...@healthfusion.com>.
>> Needed also : the version of the isapi_redirector you are using (try
using the most recent 
one).
Not sure I changed the log_level to debug and info - the version did not
print in the logs. We inherited it as a legacy setup - originally
timestamped 2004 so must be really old version. We are upgrading to 1.2.30.

Thank you for all the detailed information.

Regards,
Rumpa Giri

-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com] 
Sent: Monday, June 28, 2010 3:04 PM
To: Tomcat Users List
Subject: Re: questions on documentation for configuring AJP connector

Rumpa Giri wrote:
> We are currently using - 
> 
>  
> 
> Tomcat - 5.5.25
> 
> JDK 1.5
> 
> IIS 6
> 
> Windows XP 64bit and 32bit machines
> 

Needed also : the version of the isapi_redirector you are using (try using
the most recent 
one).

>  
> 
> We are trying to upgrade to the latest connector. While going through the
> worker properties variables to set we have few questions regarding the
> following -
> 
>  
> 
> 1) connection_pool_size - 
> 
>  
> 
>>> Usually this is the same as the number of threads per web server
process.
> (cut-paste from the description for connection_pool_size)
> 
>  
> 
> I am not familiar with IIS - so how do you determine the above?

Also cut-paste from the online documentation :
We strongly recommend adjusting this value for IIS and the Netscape/Sun to
the number of 
requests one web server process should be able to send to a backend in
parallel. You 
should measure how many connections you need during peak activity without
performance 
problems, and then add some percentage depending on your growth rate.
Finally you should 
check, whether your web server processes are able to use at least as many
threads, as you 
configured as the pool size.

> 
>  
> 
>>> You should measure how many connections you need during peak activity
> without performance problems, and then add some percentage depending on
your
> growth rate.

> 
>  
> 
> How do you determine what is a good percentage?
> 
>  
Intuitively, it means :
- today you want to be able to serve 100 requests in parallel, so you
configure 
connection_pool_size to 100 as a basic number.
- you want to review this in 30 days
- during these 30 days, you expect the number of parallel requests to grow
by 10%, so at 
the end of the 30 days you expect to have to handle 100 + 10% = 110
requests.
So set connection_pool_size now to 110, and review this in 30 days.
(Adapt for growth rate and review time).


> 
> Also does this property have any correlation with the attribute MaxThreads
> in the <Connector> tag of server.xml? How do you determine what value
should
> you put for MaxThreads?
> 
Yes, it has a correlation, but not direct, and it depends on many factors,
and it is quite 
hard to explain exhaustively, which is why the documentation gives you hints
rather than a 
definitive formula.

But let me try :

connection_pool_size determines how many TCP connections the front-end IIS 
isapi_redirector is going to establish, as a maximum, with the back-end
Tomcat to pass 
requests to Tomcat.  The redirector, once it has opened such a connection,
is going to try 
to keep it open for a while, to minimise the overhead of having to re-create
new 
connections all the time.
(If a connection is not being used, after connection_pool_timeout, the
redirector will 
close it).

MaxThreads basically determines how many threads maximum Tomcat will start
to serve 
requests in parallel.  When Tomcat receives a request, it starts a thread to
handle this 
request and produce a response. Once the response is produced and entirely
sent back over 
the connection to the front-end, this thread exits.  So how long one thread
takes to exit, 
is proportional to the time it takes to service the request. If more
requests come it at 
once, than the number of allowed threads can handle, the request has to
wait.  The 
Connector has a queue in which such requests can wait for a thread to become
available to 
service it.  This queue has a maximum size.  If it is full, and no threads
are available, 
the request will be rejected.
(see the "backlog" attribute at
http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html)

How high in the absolute you can set MaxThreads, depends on the resources
available to 
Tomcat (or to the JVM that runs Tomcat).  Each thread will use some
resources, to a point 
also depending on the characteristics of the request and of the application
which this 
thread will run to service it.

Other attributes of the Connector (such as keepAliveTimeout) play a role
too.

All these things are linked, and the optimum for each depends mostly on a
number of 
characteristics of your situation.  There is no universal formula.
Make an educated guess, try it out, monitor, and rectify if needed, one
parameter and a 
little bit at a time.

>  
> 
> 2) connection_pool_timeout - The server.xml - the default value if not
> specified explicitly is 60000(60 secs). I see in our server.xml AJP
> connector tag - its not specified - which means I do need to specify this
> property connection_pool_timeout in our worker.properties as 60? The
> documentation says the default for connection_pool_timeout is 0, shouldn't
> it be 60 if this has to be in synch with server.xml?
> 
I have not rechecked the documentation, but I seem to remember that there
are some related 
parameters on one side or the other, which are specified using different
units (such as 
milliseconds in one case and seconds in the other).  Make sure you pay
attention to these 
differences and account for them.

>  
> 
> 3) The worker.loadbalancer.method property - currently not set - but we
are
> thinking of doing as B instead of default R. What do you use in general?
Is
> there a disadvantage to switching from Request to Busyness?
> 
don't know.

>  
> 
> 4) Question on server.xml -
> 
>  
> 
> maxSpareThreads 
> 
> maxThreads 
> 
> minSpareThreads 
> 

Consult the documentation appropriate to your version of Tomcat about these
parameters.
Invalid parameters are ignored.
For example, the documentation for the AJP Connector for Tomcat 6.0, at
http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html
does not mention maxSpareThreads nor minSpareThreads.
No need to spend time on attributes which are ignored.
For maxThreads, see above.

>  
> 
> What are the criteria to select appropriate values? For production servers
-
> how do you determine the values to set?
> 
> Is there a correlation between the values for above(maxSpareThreads,
> maxThreads, minSpareThreads)
> 
>  - for example - does the maxSpareThreads have to be certain % of
> maxThreads?
> 
>  
> 
> Thank you for reading the question.
> 
>  
> 
> Regard,
> 
> Rumpa Giri
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: questions on documentation for configuring AJP connector

Posted by André Warnier <aw...@ice-sa.com>.
Rumpa Giri wrote:
> We are currently using - 
> 
>  
> 
> Tomcat - 5.5.25
> 
> JDK 1.5
> 
> IIS 6
> 
> Windows XP 64bit and 32bit machines
> 

Needed also : the version of the isapi_redirector you are using (try using the most recent 
one).

>  
> 
> We are trying to upgrade to the latest connector. While going through the
> worker properties variables to set we have few questions regarding the
> following -
> 
>  
> 
> 1) connection_pool_size - 
> 
>  
> 
>>> Usually this is the same as the number of threads per web server process.
> (cut-paste from the description for connection_pool_size)
> 
>  
> 
> I am not familiar with IIS - so how do you determine the above?

Also cut-paste from the online documentation :
We strongly recommend adjusting this value for IIS and the Netscape/Sun to the number of 
requests one web server process should be able to send to a backend in parallel. You 
should measure how many connections you need during peak activity without performance 
problems, and then add some percentage depending on your growth rate. Finally you should 
check, whether your web server processes are able to use at least as many threads, as you 
configured as the pool size.

> 
>  
> 
>>> You should measure how many connections you need during peak activity
> without performance problems, and then add some percentage depending on your
> growth rate.

> 
>  
> 
> How do you determine what is a good percentage?
> 
>  
Intuitively, it means :
- today you want to be able to serve 100 requests in parallel, so you configure 
connection_pool_size to 100 as a basic number.
- you want to review this in 30 days
- during these 30 days, you expect the number of parallel requests to grow by 10%, so at 
the end of the 30 days you expect to have to handle 100 + 10% = 110 requests.
So set connection_pool_size now to 110, and review this in 30 days.
(Adapt for growth rate and review time).


> 
> Also does this property have any correlation with the attribute MaxThreads
> in the <Connector> tag of server.xml? How do you determine what value should
> you put for MaxThreads?
> 
Yes, it has a correlation, but not direct, and it depends on many factors, and it is quite 
hard to explain exhaustively, which is why the documentation gives you hints rather than a 
definitive formula.

But let me try :

connection_pool_size determines how many TCP connections the front-end IIS 
isapi_redirector is going to establish, as a maximum, with the back-end Tomcat to pass 
requests to Tomcat.  The redirector, once it has opened such a connection, is going to try 
to keep it open for a while, to minimise the overhead of having to re-create new 
connections all the time.
(If a connection is not being used, after connection_pool_timeout, the redirector will 
close it).

MaxThreads basically determines how many threads maximum Tomcat will start to serve 
requests in parallel.  When Tomcat receives a request, it starts a thread to handle this 
request and produce a response. Once the response is produced and entirely sent back over 
the connection to the front-end, this thread exits.  So how long one thread takes to exit, 
is proportional to the time it takes to service the request. If more requests come it at 
once, than the number of allowed threads can handle, the request has to wait.  The 
Connector has a queue in which such requests can wait for a thread to become available to 
service it.  This queue has a maximum size.  If it is full, and no threads are available, 
the request will be rejected.
(see the "backlog" attribute at http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html)

How high in the absolute you can set MaxThreads, depends on the resources available to 
Tomcat (or to the JVM that runs Tomcat).  Each thread will use some resources, to a point 
also depending on the characteristics of the request and of the application which this 
thread will run to service it.

Other attributes of the Connector (such as keepAliveTimeout) play a role too.

All these things are linked, and the optimum for each depends mostly on a number of 
characteristics of your situation.  There is no universal formula.
Make an educated guess, try it out, monitor, and rectify if needed, one parameter and a 
little bit at a time.

>  
> 
> 2) connection_pool_timeout - The server.xml - the default value if not
> specified explicitly is 60000(60 secs). I see in our server.xml AJP
> connector tag - its not specified - which means I do need to specify this
> property connection_pool_timeout in our worker.properties as 60? The
> documentation says the default for connection_pool_timeout is 0, shouldn't
> it be 60 if this has to be in synch with server.xml?
> 
I have not rechecked the documentation, but I seem to remember that there are some related 
parameters on one side or the other, which are specified using different units (such as 
milliseconds in one case and seconds in the other).  Make sure you pay attention to these 
differences and account for them.

>  
> 
> 3) The worker.loadbalancer.method property - currently not set - but we are
> thinking of doing as B instead of default R. What do you use in general? Is
> there a disadvantage to switching from Request to Busyness?
> 
don't know.

>  
> 
> 4) Question on server.xml -
> 
>  
> 
> maxSpareThreads 
> 
> maxThreads 
> 
> minSpareThreads 
> 

Consult the documentation appropriate to your version of Tomcat about these parameters.
Invalid parameters are ignored.
For example, the documentation for the AJP Connector for Tomcat 6.0, at
http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html
does not mention maxSpareThreads nor minSpareThreads.
No need to spend time on attributes which are ignored.
For maxThreads, see above.

>  
> 
> What are the criteria to select appropriate values? For production servers -
> how do you determine the values to set?
> 
> Is there a correlation between the values for above(maxSpareThreads,
> maxThreads, minSpareThreads)
> 
>  - for example - does the maxSpareThreads have to be certain % of
> maxThreads?
> 
>  
> 
> Thank you for reading the question.
> 
>  
> 
> Regard,
> 
> Rumpa Giri
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org