tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: questions on documentation for configuring AJP connector
Date Mon, 28 Jun 2010 22:04:10 GMT
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


Mime
View raw message