Author: mturk Date: Tue Oct 7 01:42:30 2008 New Revision: 702387 URL: http://svn.apache.org/viewvc?rev=702387&view=rev Log: Add connection_acquire_timeout directive. It helps diferentiating the timeout for obtaining cache endpoint and retry on the obtained worker connection
Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c tomcat/connectors/trunk/jk/native/common/jk_util.c tomcat/connectors/trunk/jk/native/common/jk_util.h tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml tomcat/connectors/trunk/jk/xdocs/reference/workers.xml Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?rev=702387&r1=702386&r2=702387&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original) +++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Tue Oct 7 01:42:30 2008 @@ -2454,8 +2454,8 @@ } if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "setting connection pool size to %u with min %u", - p->ep_cache_sz, p->ep_mincache_sz); + "setting connection pool size to %u with min %u and acquire timeout %d", + p->ep_cache_sz, p->ep_mincache_sz, p->cache_acquire_timeout); for (i = 0; i < p->ep_cache_sz; i++) { p->ep_cache[i] = (ajp_endpoint_t *)calloc(1, sizeof(ajp_endpoint_t)); if (!p->ep_cache[i]) { @@ -2557,8 +2557,9 @@ p->retry_interval = jk_get_worker_retry_interval(props, p->name, - JK_SLEEP_DEF); - + JK_SLEEP_DEF); + p->cache_acquire_timeout = jk_get_worker_cache_acquire_timeout(props, + p->name, p->retries * p->retry_interval); p->http_status_fail_num = jk_get_worker_fail_on_status(props, p->name, &p->http_status_fail[0], JK_MAX_HTTP_STATUS_FAILS); @@ -2819,8 +2820,8 @@ int retry = 0; *je = NULL; - /* Obtain current time only if needed */ - while (retry < aw->retries) { + /* Loop until cache_acquire_timeout interval elapses */ + while ((retry * JK_SLEEP_DEF) < aw->cache_acquire_timeout) { JK_ENTER_CS(&aw->cs, rc); if (rc) { @@ -2853,8 +2854,8 @@ *je = &ae->endpoint; if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "acquired connection pool slot=%u", - slot); + "acquired connection pool slot=%u after %d retries", + slot, retry); JK_TRACE_EXIT(l); return JK_TRUE; } @@ -2864,8 +2865,8 @@ jk_log(l, JK_LOG_DEBUG, "could not get free endpoint for worker %s" " (retry %d, sleeping for %d ms)", - aw->name, retry, aw->retry_interval); - jk_sleep(aw->retry_interval); + aw->name, retry, JK_SLEEP_DEF); + jk_sleep(JK_SLEEP_DEF); } } else { Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?rev=702387&r1=702386&r2=702387&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_util.c (original) +++ tomcat/connectors/trunk/jk/native/common/jk_util.c Tue Oct 7 01:42:30 2008 @@ -52,6 +52,7 @@ #define CACHE_OF_WORKER_MIN ("connection_pool_minsize") #define CACHE_TIMEOUT_DEPRECATED ("cache_timeout") #define CACHE_TIMEOUT_OF_WORKER ("connection_pool_timeout") +#define CACHE_ACQUIRE_OF_WORKER ("connection_acquire_timeout") #define RECOVERY_OPTS_OF_WORKER ("recovery_options") #define CONNECT_TIMEOUT_OF_WORKER ("connect_timeout") #define PREPOST_TIMEOUT_OF_WORKER ("prepost_timeout") @@ -173,6 +174,7 @@ CACHE_OF_WORKER_MIN, CACHE_TIMEOUT_DEPRECATED, CACHE_TIMEOUT_OF_WORKER, + CACHE_ACQUIRE_OF_WORKER, RECOVERY_OPTS_OF_WORKER, CONNECT_TIMEOUT_OF_WORKER, PREPOST_TIMEOUT_OF_WORKER, @@ -262,6 +264,7 @@ CACHE_OF_WORKER_MIN, CACHE_TIMEOUT_DEPRECATED, CACHE_TIMEOUT_OF_WORKER, + CACHE_ACQUIRE_OF_WORKER, RECOVERY_OPTS_OF_WORKER, CONNECT_TIMEOUT_OF_WORKER, PREPOST_TIMEOUT_OF_WORKER, @@ -931,6 +934,18 @@ return jk_map_get_int(m, buf, def); } +int jk_get_worker_cache_acquire_timeout(jk_map_t *m, const char *wname, int def) +{ + char buf[1024]; + + if (!m || !wname) { + return -1; + } + + MAKE_WORKER_PARAM(CACHE_ACQUIRE_OF_WORKER); + return jk_map_get_int(m, buf, def); +} + int jk_get_worker_socket_timeout(jk_map_t *m, const char *wname, int def) { char buf[1024]; Modified: tomcat/connectors/trunk/jk/native/common/jk_util.h URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.h?rev=702387&r1=702386&r2=702387&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_util.h (original) +++ tomcat/connectors/trunk/jk/native/common/jk_util.h Tue Oct 7 01:42:30 2008 @@ -70,6 +70,8 @@ int jk_get_worker_cache_size_min(jk_map_t *m, const char *wname, int def); +int jk_get_worker_cache_acquire_timeout(jk_map_t *m, const char *wname, int def); + int jk_get_worker_socket_timeout(jk_map_t *m, const char *wname, int def); int jk_get_worker_socket_buffer(jk_map_t *m, const char *wname, int def); Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?rev=702387&r1=702386&r2=702387&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Tue Oct 7 01:42:30 2008 @@ -44,6 +44,10 @@ <subsection name="Native"> <changelog> <update> + Added connection_acquire_timeout directive for setting the + absolute timeout the worker will wait for a free endpoint. (mturk) + </update> + <update> Status: Allow showing only a single member for a load balancer. (rjung) </update> <update> Modified: tomcat/connectors/trunk/jk/xdocs/reference/workers.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/workers.xml?rev=702387&r1=702386&r2=702387&view=diff ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/reference/workers.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/reference/workers.xml Tue Oct 7 01:42:30 2008 @@ -356,6 +356,16 @@ </p> </directive> +<directive name="connection_acquire_timeout" default="retries*retry_interval" required="false"> +Timeout the worker will wait for a free socket in cache before giving up. +<p> +Its default value is <b>retries * retry_interval</b>. +</p> +<p> +This feature has been added in <b>jk 1.2.27</b>. +</p> +</directive> + <directive name="lbfactor" default="1" required="false"> Only used for a member worker of a load balancer. <p> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]