You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Scott, Sean" <Se...@mdx.com> on 2003/12/03 18:18:59 UTC

[JK2 Enhancement] modify behavior when max_endpoints have been re ached

I have locally modified the head revision of the jk2 project and would like
some feedback before submitting the enhancements for review.

The change in behavior that we desired was that rather than returning an
error when the max_connections for the endpoint cache were reached, the
worker would wait for an endpoint to be returned to the cache.  

Consider the scenario where apache is configured to have lots ( lets say 900
) of worker threads, but we want to limit the connections to tomcat to just
a few ( lets say 15 ). Without the enhancement I am proposing, we had to
configure the AJP connector in tomcat as follows. 
connection timeout = 1 ( problematic as testing using a slow connection
would drop connections ), 
accept count 1000 ( needed so that we could queue up requests from apache )
max threads = 30 ( We determined that jdk/tomcat we spend more time waiting
than working with more threads than this )
And configure jk2 not to limit the connections to tomcat.

This configuration allowed us to handle the desired load. We test with 1000
virtual users, which maps to about 2000 real users for our tests. We could
handle the load but the log files filled with error messages, apparently to
JK2 its an error when tomcat closes the connection on its end. The test also
had a couple hundred errors after about 10000 page views.

To implement this functionality I modified the jk_mutex_thread.c module to
include a wait and a notify method (using the apr_thread_cond routines).  I
then modified the ajp13 worker to wait (forever) when the max_endpoints are
reached. I also modified the "jk2_worker_ajp13_done" method to "notify" when
an endpoint was returned to the cache.

After load testing the resulting code, after close to 11000 page views we
had 0 errors and response times remained at about .2 seconds (no slower than
jk2 without my mods).

I didnt add a wait timeout because I didnt feel in our case that an error
should be returned to the client. But perhaps the option to specify a
timeout could be useful to someone else.

Comments?

-sean


CONFIDENTIALITY NOTICE - This e-mail transmission, and any documents, files or previous e-mail messages attached to it may contain information that is confidential or legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that you must not read this transmission and that any disclosure, copying, printing, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify the sender by telephone or return e-mail and delete the original transmission and its attachments without reading or saving in any manner. Thank you

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


RE: [JK2 Enhancement] modify behavior when max_endpoints have been reached

Posted by Mladen Turk <mt...@apache.org>.
 

> From: Scott, Sean
> 
> I have locally modified the head revision of the jk2 project 
> and would like some feedback before submitting the 
> enhancements for review.
> 
> The change in behavior that we desired was that rather than 
> returning an error when the max_connections for the endpoint 
> cache were reached, the worker would wait for an endpoint to 
> be returned to the cache.  
> 
> To implement this functionality I modified the 
> jk_mutex_thread.c module to include a wait and a notify 
> method (using the apr_thread_cond routines).  I then modified 
> the ajp13 worker to wait (forever) when the max_endpoints are 
> reached. I also modified the "jk2_worker_ajp13_done" method 
> to "notify" when an endpoint was returned to the cache.
> 

-1 on mutex/wait approach.

Using that we would reinvent the wheel.

There is an excellent API in the APR-UTILS that will allow us to do
a non-blocking approach.
Take a look at apr_reslist API.
Since we agreed to use the apr _and_ apr_util as mandatory, take a
look at those. The reslist is meant to be used for such purposes.

MT.


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