tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r550272 - in /tomcat/connectors/trunk/jk: native/common/ xdocs/miscellaneous/ xdocs/reference/
Date Sun, 24 Jun 2007 18:33:36 GMT
Author: rjung
Date: Sun Jun 24 11:33:33 2007
New Revision: 550272

URL: http://svn.apache.org/viewvc?view=rev&rev=550272
Log:
New load balancer attribute max_reply_timeouts, to make lb tolerant against
occasional long running requests. The counter will be decayed during
lb maintenance.
Also adjusted docs to make reply_timeout explanation more correct.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_ajp13.h
    tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
    tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
    tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h
    tomcat/connectors/trunk/jk/native/common/jk_shm.h
    tomcat/connectors/trunk/jk/native/common/jk_status.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/status.xml
    tomcat/connectors/trunk/jk/xdocs/reference/workers.xml

Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp13.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp13.h?view=diff&rev=550272&r1=550271&r2=550272
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp13.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp13.h Sun Jun 24 11:33:33 2007
@@ -45,6 +45,7 @@
 #define JK_CLIENT_RD_ERROR          (-6)
 #define JK_CLIENT_WR_ERROR          (-7)
 #define JK_STATUS_ERROR             (-8)
+#define JK_REPLY_TIMEOUT            (-9)
 
 #define AJP13_MAX_SEND_BODY_SZ      (DEF_BUFFER_SZ - 6)
 #define AJP13_DEF_TIMEOUT           (0) /* Idle timout for pooled connections */

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?view=diff&rev=550272&r1=550271&r2=550272
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Sun Jun 24 11:33:33 2007
@@ -1587,7 +1587,7 @@
     while (1) {
         int rc = 0;
 
-        /* If we set a reply timeout, check it something is available */
+        /* If we set a reply timeout, check if something is available */
         if (p->worker->reply_timeout > 0) {
             if (ajp_is_input_event(p, p->worker->reply_timeout, l) ==
                 JK_FALSE) {
@@ -1619,7 +1619,7 @@
                 }
 
                 JK_TRACE_EXIT(l);
-                return JK_FALSE;
+                return JK_REPLY_TIMEOUT;
             }
         }
 
@@ -1810,7 +1810,8 @@
                                  jk_ws_service_t *s,
                                  jk_logger_t *l, int *is_error)
 {
-    int i, err;
+    int i;
+    int err = JK_TRUE;
     ajp_operation_t oper;
     ajp_operation_t *op = &oper;
     ajp_endpoint_t *p;
@@ -1963,6 +1964,10 @@
                            "without recovery in send loop attempt=%d",
                            p->worker->name, i);
                     JK_TRACE_EXIT(l);
+                    if (err == JK_REPLY_TIMEOUT) {
+                        *is_error = JK_HTTP_GATEWAY_TIME_OUT;
+                        return JK_REPLY_TIMEOUT;
+                    }
                     return JK_FALSE;
                 }
                 jk_log(l, JK_LOG_INFO,
@@ -2022,6 +2027,10 @@
            p->worker->name);
 
     JK_TRACE_EXIT(l);
+    if (err == JK_REPLY_TIMEOUT) {
+        *is_error = JK_HTTP_GATEWAY_TIME_OUT;
+        return JK_REPLY_TIMEOUT;
+    }
     return JK_FALSE;
 }
 

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?view=diff&rev=550272&r1=550271&r2=550272
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Sun Jun 24 11:33:33 2007
@@ -273,6 +273,7 @@
     p->sticky_session = p->s->sticky_session;
     p->sticky_session_force = p->s->sticky_session_force;
     p->recover_wait_time = p->s->recover_wait_time;
+    p->max_reply_timeouts = p->s->max_reply_timeouts;
     p->retries = p->s->retries;
     p->lbmethod = p->s->lbmethod;
     p->lblock = p->s->lblock;
@@ -290,6 +291,7 @@
     p->s->sticky_session = p->sticky_session;
     p->s->sticky_session_force = p->sticky_session_force;
     p->s->recover_wait_time = p->recover_wait_time;
+    p->s->max_reply_timeouts = p->max_reply_timeouts;
     p->s->retries = p->retries;
     p->s->lbmethod = p->lbmethod;
     p->s->lblock = p->lblock;
@@ -446,6 +448,7 @@
                            w->s->name);
                 if (p->lbmethod != JK_LB_METHOD_BUSYNESS)
                     w->s->lb_value = curmax;
+                w->s->reply_timeouts = 0;
                 w->s->state = JK_LB_STATE_RECOVER;
                 non_error++;
             }
@@ -505,6 +508,7 @@
             if (p->lb_workers[i].s->lb_value > curmax) {
                 curmax = p->lb_workers[i].s->lb_value;
             }
+            p->lb_workers[i].s->reply_timeouts >>= exponent;
         }
     }
     JK_TRACE_EXIT(l);
@@ -1074,14 +1078,6 @@
                     rc = JK_CLIENT_ERROR;
                 }
                 else {
-                    /*
-                    * Service failed !!!
-                    * Time for fault tolerance (if possible)...
-                    */
-
-                    rec->s->errors++;
-                    rec->s->state = JK_LB_STATE_ERROR;
-                    rec->s->error_time = time(NULL);
                     if (is_service_error != JK_HTTP_SERVER_BUSY) {
                         /*
                         * Error is not recoverable - break with an error.
@@ -1094,10 +1090,24 @@
                         *is_error = is_service_error;
                         rc = JK_FALSE;
                     }
-                    else
+                    if (service_stat == JK_REPLY_TIMEOUT) {
+                        rec->s->reply_timeouts++;
+                    }
+                    if (service_stat != JK_REPLY_TIMEOUT ||
+                        rec->s->reply_timeouts > p->worker->s->max_reply_timeouts)
{
+
+                        /*
+                        * Service failed !!!
+                        * Time for fault tolerance (if possible)...
+                        */
+
+                        rec->s->errors++;
+                        rec->s->state = JK_LB_STATE_ERROR;
+                        rec->s->error_time = time(NULL);
                         jk_log(l, JK_LOG_INFO,
                                "service failed, worker %s is in error state",
                                rec->s->name);
+                    }
                 }
                 if (p->worker->lblock == JK_LB_LOCK_PESSIMISTIC)
                     jk_shm_unlock();
@@ -1346,6 +1356,8 @@
                                                             WAIT_BEFORE_RECOVER);
     if (p->recover_wait_time < 1)
         p->recover_wait_time = 1;
+    p->max_reply_timeouts = jk_get_worker_max_reply_timeouts(props, p->s->name,
+                                                             0);
     p->maintain_time = jk_get_worker_maintain_time(props);
     if(p->maintain_time < 0)
         p->maintain_time = 0;
@@ -1449,6 +1461,7 @@
         private_data->worker.maintain = maintain_workers;
         private_data->worker.retries = JK_RETRIES;
         private_data->recover_wait_time = WAIT_BEFORE_RECOVER;
+        private_data->max_reply_timeouts = 0;
         private_data->sequence = 0;
         *w = &private_data->worker;
         JK_TRACE_EXIT(l);

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h?view=diff&rev=550272&r1=550271&r2=550272
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h Sun Jun 24 11:33:33 2007
@@ -136,6 +136,7 @@
     int          sticky_session;
     int          sticky_session_force;
     int          recover_wait_time;
+    int          max_reply_timeouts;
     int          retries;
     int          lbmethod;
     int          lblock;

Modified: tomcat/connectors/trunk/jk/native/common/jk_shm.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_shm.h?view=diff&rev=550272&r1=550271&r2=550272
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_shm.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_shm.h Sun Jun 24 11:33:33 2007
@@ -92,6 +92,7 @@
     int     sticky_session;
     int     sticky_session_force;
     int     recover_wait_time;
+    int     max_reply_timeouts;
     int     retries;
     int     lbmethod;
     int     lblock;
@@ -114,6 +115,8 @@
     volatile jk_uint32_t  recoveries;
     /* Number of recovery failures */
     volatile jk_uint32_t  recovery_errors;
+    /* Decayed number of reply_timeout errors */
+    volatile jk_uint32_t  reply_timeouts;
     /* Number of client errors */
     volatile jk_uint32_t  client_errors;
 };

Modified: tomcat/connectors/trunk/jk/native/common/jk_status.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_status.c?view=diff&rev=550272&r1=550271&r2=550272
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_status.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_status.c Sun Jun 24 11:33:33 2007
@@ -73,6 +73,7 @@
 
 #define JK_STATUS_ARG_LB_RETRIES           ("lr")
 #define JK_STATUS_ARG_LB_RECOVER_TIME      ("lt")
+#define JK_STATUS_ARG_LB_MAX_REPLY_TIMEOUTS ("lx")
 #define JK_STATUS_ARG_LB_STICKY            ("ls")
 #define JK_STATUS_ARG_LB_STICKY_FORCE      ("lf")
 #define JK_STATUS_ARG_LB_METHOD            ("lm")
@@ -80,6 +81,7 @@
 
 #define JK_STATUS_ARG_LB_TEXT_RETRIES      "Retries"
 #define JK_STATUS_ARG_LB_TEXT_RECOVER_TIME "Recover Wait Time"
+#define JK_STATUS_ARG_LB_TEXT_MAX_REPLY_TIMEOUTS "Max Reply Timeouts"
 #define JK_STATUS_ARG_LB_TEXT_STICKY       "Sticky Sessions"
 #define JK_STATUS_ARG_LB_TEXT_STICKY_FORCE "Force Sticky Sessions"
 #define JK_STATUS_ARG_LB_TEXT_METHOD       "LB Method"
@@ -188,6 +190,7 @@
                                            "<th>" JK_STATUS_ARG_LB_TEXT_METHOD "</th>"
\
                                            "<th>" JK_STATUS_ARG_LB_TEXT_LOCK "</th>"
\
                                            "<th>" JK_STATUS_ARG_LB_TEXT_RECOVER_TIME
"</th>" \
+                                           "<th>" JK_STATUS_ARG_LB_TEXT_MAX_REPLY_TIMEOUTS
"</th>" \
                                            "</tr>\n"
 #define JK_STATUS_SHOW_LB_ROW              "<tr>" \
                                            "<td>%s</td>" \
@@ -197,6 +200,7 @@
                                            "<td>%s</td>" \
                                            "<td>%s</td>" \
                                            "<td>%d</td>" \
+                                           "<td>%d</td>" \
                                            "</tr>\n"
 #define JK_STATUS_SHOW_MEMBER_HEAD         "<tr>" \
                                            "<th>&nbsp;</th><th>Name</th><th>Type</th>"
\
@@ -204,7 +208,7 @@
                                            "<th>Act</th><th>State</th>"
\
                                            "<th>D</th><th>F</th><th>M</th>"
\
                                            "<th>V</th><th>Acc</th>"
\
-                                           "<th>Err</th><th>CE</th>"
\
+                                           "<th>Err</th><th>CE</th><th>RE</th>"
\
                                            "<th>Wr</th><th>Rd</th><th>Busy</th><th>Max</th>"
\
                                            "<th>" JK_STATUS_ARG_LBM_TEXT_ROUTE "</th>"
\
                                            "<th>RR</th><th>Cd</th><th>Rs</th>"
\
@@ -222,6 +226,7 @@
                                            "<td>%" JK_UINT64_T_FMT "</td>" \
                                            "<td>%" JK_UINT32_T_FMT "</td>" \
                                            "<td>%" JK_UINT32_T_FMT "</td>" \
+                                           "<td>%" JK_UINT32_T_FMT "</td>" \
                                            "<td>%s</td>" \
                                            "<td>%s</td>" \
                                            "<td>%d</td>" \
@@ -1369,7 +1374,8 @@
                   lb->retries,
                   jk_lb_get_method(lb, l),
                   jk_lb_get_lock(lb, l),
-                  lb->recover_wait_time);
+                  lb->recover_wait_time,
+                  lb->max_reply_timeouts);
         jk_puts(s, "</table>\n<br/>\n");
 
         jk_puts(s, "<table><tr>"
@@ -1393,6 +1399,7 @@
         jk_print_xml_att_string(s, 4, "sticky_session_force", jk_get_bool(lb->sticky_session_force));
         jk_print_xml_att_int(s, 4, "retries", lb->retries);
         jk_print_xml_att_int(s, 4, "recover_time", lb->recover_wait_time);
+        jk_print_xml_att_int(s, 4, "max_reply_timeouts", lb->max_reply_timeouts);
         jk_print_xml_att_string(s, 4, "method", jk_lb_get_method(lb, l));
         jk_print_xml_att_string(s, 4, "lock", jk_lb_get_lock(lb, l));
         jk_print_xml_att_int(s, 4, "member_count", lb->num_of_workers);
@@ -1416,6 +1423,7 @@
         jk_printf(s, " sticky_session_force=%s", jk_get_bool(lb->sticky_session_force));
         jk_printf(s, " retries=%d", lb->retries);
         jk_printf(s, " recover_time=%d", lb->recover_wait_time);
+        jk_printf(s, " max_reply_timeouts=%d", lb->max_reply_timeouts);
         jk_printf(s, " method=%s", jk_lb_get_method(lb, l));
         jk_printf(s, " lock=%s", jk_lb_get_lock(lb, l));
         jk_printf(s, " member_count=%d", lb->num_of_workers);
@@ -1438,6 +1446,7 @@
         jk_print_prop_att_string(s, w, name, "sticky_session_force", jk_get_bool(lb->sticky_session_force));
         jk_print_prop_att_int(s, w, name, "retries", lb->retries);
         jk_print_prop_att_int(s, w, name, "recover_time", lb->recover_wait_time);
+        jk_print_prop_att_int(s, w, name, "max_reply_timeouts", lb->max_reply_timeouts);
         jk_print_prop_att_string(s, w, name, "method", jk_lb_get_method(lb, l));
         jk_print_prop_att_string(s, w, name, "lock", jk_lb_get_lock(lb, l));
         jk_print_prop_att_int(s, w, name, "member_count", lb->num_of_workers);
@@ -1518,6 +1527,7 @@
                           wr->s->elected,
                           wr->s->errors,
                           wr->s->client_errors,
+                          wr->s->reply_timeouts,
                           status_strfsize(wr->s->transferred, buf_wr),
                           status_strfsize(wr->s->readed, buf_rd),
                           wr->s->busy,
@@ -1549,6 +1559,7 @@
                 jk_print_xml_att_uint64(s, 8, "elected", wr->s->elected);
                 jk_print_xml_att_uint32(s, 8, "errors", wr->s->errors);
                 jk_print_xml_att_uint32(s, 8, "client_errors", wr->s->client_errors);
+                jk_print_xml_att_uint32(s, 8, "reply_timeouts", wr->s->reply_timeouts);
                 jk_print_xml_att_uint64(s, 8, "transferred", wr->s->transferred);
                 jk_print_xml_att_uint64(s, 8, "read", wr->s->readed);
                 jk_print_xml_att_int(s, 8, "busy", wr->s->busy);
@@ -1579,6 +1590,7 @@
                 jk_printf(s, " elected=%" JK_UINT64_T_FMT, wr->s->elected);
                 jk_printf(s, " errors=%" JK_UINT32_T_FMT, wr->s->errors);
                 jk_printf(s, " client_errors=%" JK_UINT32_T_FMT, wr->s->client_errors);
+                jk_printf(s, " reply_timeouts=%" JK_UINT32_T_FMT, wr->s->reply_timeouts);
                 jk_printf(s, " transferred=%" JK_UINT64_T_FMT, wr->s->transferred);
                 jk_printf(s, " read=%" JK_UINT64_T_FMT, wr->s->readed);
                 jk_printf(s, " busy=%d", wr->s->busy);
@@ -1607,6 +1619,7 @@
                 jk_print_prop_att_uint64(s, w, wr->s->name, "elected", wr->s->elected);
                 jk_print_prop_att_uint32(s, w, wr->s->name, "errors", wr->s->errors);
                 jk_print_prop_att_uint32(s, w, wr->s->name, "client_errors", wr->s->client_errors);
+                jk_print_prop_att_uint32(s, w, wr->s->name, "reply_timeouts", wr->s->reply_timeouts);
                 jk_print_prop_att_uint64(s, w, wr->s->name, "transferred", wr->s->transferred);
                 jk_print_prop_att_uint64(s, w, wr->s->name, "read", wr->s->readed);
                 jk_print_prop_att_int(s, w, wr->s->name, "busy", wr->s->busy);
@@ -1862,6 +1875,10 @@
             ":</td><td><input name=\"",
             JK_STATUS_ARG_LB_RECOVER_TIME, "\" type=\"text\" ", NULL);
     jk_printf(s, "value=\"%d\"/></td></tr>\n", lb->recover_wait_time);
+    jk_putv(s, "<tr><td>", JK_STATUS_ARG_LB_TEXT_MAX_REPLY_TIMEOUTS,
+            ":</td><td><input name=\"",
+            JK_STATUS_ARG_LB_MAX_REPLY_TIMEOUTS, "\" type=\"text\" ", NULL);
+    jk_printf(s, "value=\"%d\"/></td></tr>\n", lb->max_reply_timeouts);
     jk_putv(s, "<tr><td>", JK_STATUS_ARG_LB_TEXT_STICKY,
             ":</td><td><input name=\"",
             JK_STATUS_ARG_LB_STICKY, "\" type=\"checkbox\"", NULL);
@@ -2163,6 +2180,14 @@
                w->name, name, i);
         lb->recover_wait_time = i;
     }
+    i = status_get_int(p, JK_STATUS_ARG_LB_MAX_REPLY_TIMEOUTS,
+                       lb->max_reply_timeouts, l);
+    if (i != lb->max_reply_timeouts && i >= 0) {
+        jk_log(l, JK_LOG_INFO,
+               "Status worker '%s' setting 'max_reply_timeouts' for lb worker '%s' to '%i'",
+               w->name, name, i);
+        lb->max_reply_timeouts = i;
+    }
     i = status_get_bool(p, JK_STATUS_ARG_LB_STICKY, 0, l);
     if (i != lb->sticky_session) {
         jk_log(l, JK_LOG_INFO,
@@ -2480,6 +2505,7 @@
             "<tr><th>Acc</th><td>Number of requests</td></tr>\n"
             "<tr><th>Err</th><td>Number of failed requests</td></tr>\n"
             "<tr><th>CE</th><td>Number of client errors</td></tr>\n"
+            "<tr><th>RE</th><td>Number of reply timeouts (decayed)</td></tr>\n"
             "<tr><th>Wr</th><td>Number of bytes transferred/min</td></tr>\n"
             "<tr><th>Rd</th><td>Number of bytes read/min</td></tr>\n"
             "<tr><th>Busy</th><td>Current number of busy connections</td></tr>\n"
@@ -2843,6 +2869,7 @@
         for (i = 0; i < lb->num_of_workers; i++) {
             wr = &(lb->lb_workers[i]);
             wr->s->client_errors    = 0;
+            wr->s->reply_timeouts   = 0;
             wr->s->elected          = 0;
             wr->s->elected_snapshot = 0;
             wr->s->error_time       = 0;
@@ -2864,6 +2891,7 @@
             return JK_FALSE;
         }
         wr->s->client_errors    = 0;
+        wr->s->reply_timeouts   = 0;
         wr->s->elected          = 0;
         wr->s->elected_snapshot = 0;
         wr->s->error_time       = 0;
@@ -2905,6 +2933,27 @@
     }
 
     if (wr->s->state == JK_LB_STATE_ERROR) {
+        lb_worker_t *lb = NULL;
+
+        /* We need an lb to correct the lb_value */
+        if (check_valid_lb(s, p, jw, worker, &lb, 0, l) == JK_FALSE) {
+            JK_TRACE_EXIT(l);
+            return JK_FALSE;
+        }
+
+        if (lb->lbmethod != JK_LB_METHOD_BUSYNESS) {
+            unsigned int i;
+            jk_uint64_t curmax = 0;
+
+            for (i = 0; i < lb->num_of_workers; i++) {
+                if (lb->lb_workers[i].s->lb_value > curmax) {
+                    curmax = lb->lb_workers[i].s->lb_value;
+                }
+            }
+            wr->s->lb_value = curmax;
+        }
+
+        wr->s->reply_timeouts = 0;
         wr->s->state = JK_LB_STATE_RECOVER;
         jk_log(l, JK_LOG_INFO,
                "Status worker '%s' marked worker '%s' sub worker '%s' for recovery",

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?view=diff&rev=550272&r1=550271&r2=550272
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Sun Jun 24 11:33:33 2007
@@ -78,6 +78,7 @@
 #define IS_WORKER_STOPPED_DEPRECATED  ("stopped")
 #define ACTIVATION_OF_WORKER        ("activation")
 #define WORKER_RECOVER_TIME         ("recover_time")
+#define MAX_REPLY_TIMEOUTS_OF_WORKER ("max_reply_timeouts")
 #define WORKER_MAX_PACKET_SIZE      ("max_packet_size")
 #define STYLE_SHEET_OF_WORKER       ("css")
 #define NAMESPACE_OF_WORKER         ("ns")
@@ -180,6 +181,7 @@
     IS_WORKER_STOPPED_DEPRECATED,
     ACTIVATION_OF_WORKER,
     WORKER_RECOVER_TIME,
+    MAX_REPLY_TIMEOUTS_OF_WORKER,
     WORKER_MAX_PACKET_SIZE,
     STYLE_SHEET_OF_WORKER,
     READ_ONLY_OF_WORKER,
@@ -265,6 +267,7 @@
     IS_WORKER_STOPPED_DEPRECATED,
     ACTIVATION_OF_WORKER,
     WORKER_RECOVER_TIME,
+    MAX_REPLY_TIMEOUTS_OF_WORKER,
     WORKER_MAX_PACKET_SIZE,
     STYLE_SHEET_OF_WORKER,
     NAMESPACE_OF_WORKER,
@@ -729,6 +732,19 @@
     }
 
     MAKE_WORKER_PARAM(WORKER_RECOVER_TIME);
+
+    return jk_map_get_int(m, buf, def);
+}
+
+int jk_get_worker_max_reply_timeouts(jk_map_t *m, const char *wname, int def)
+{
+    char buf[1024];
+
+    if (!m || !wname) {
+        return -1;
+    }
+
+    MAKE_WORKER_PARAM(MAX_REPLY_TIMEOUTS_OF_WORKER);
 
     return jk_map_get_int(m, buf, def);
 }

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?view=diff&rev=550272&r1=550271&r2=550272
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.h Sun Jun 24 11:33:33 2007
@@ -86,6 +86,8 @@
 
 int jk_get_worker_recover_timeout(jk_map_t *m, const char *wname, int def);
 
+int jk_get_worker_max_reply_timeouts(jk_map_t *m, const char *wname, int def);
+
 const char *jk_get_worker_route(jk_map_t *m, const char *wname, const char *def);
 
 const char *jk_get_worker_domain(jk_map_t *m, const char *wname, const char *def);

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?view=diff&rev=550272&r1=550271&r2=550272
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Sun Jun 24 11:33:33 2007
@@ -28,6 +28,10 @@
   <subsection name="Native">
     <changelog>
       <update>
+      LB, Status: Add feature max_reply_timeouts, to make lb tolerant against
+      occasional long running requests. (rjung)
+      </update>
+      <update>
       JkStatus: Added OK/IDLE as the successor of N/A. (rjung)
       </update>
       <update>

Modified: tomcat/connectors/trunk/jk/xdocs/reference/status.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/status.xml?view=diff&rev=550272&r1=550271&r2=550272
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/reference/status.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/reference/status.xml Sun Jun 24 11:33:33 2007
@@ -427,6 +427,9 @@
 <b>lt</b>: recover_time (seconds)
 </li>
 <li>
+<b>lx</b>: max_reply_timeouts (number)
+</li>
+<li>
 <b>ls</b>: sticky_session (0/f/n/off=off, 1/t/y/on=on; case insensitive)
 </li>
 <li>

Modified: tomcat/connectors/trunk/jk/xdocs/reference/workers.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/reference/workers.xml?view=diff&rev=550272&r1=550271&r2=550272
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/reference/workers.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/reference/workers.xml Sun Jun 24 11:33:33 2007
@@ -530,15 +530,46 @@
 </directive>
 
 <directive name="reply_timeout" default="0" required="false">
-Reply_timeout property told webserver to wait some time for reply to a forwarded request
-before considering the remote tomcat is dead and eventually switch to another tomcat in a
cluster
-group. By default (value zero) the webserver will wait forever which could be an issue for
you.
-The parameter is the number of milliseconds to wait for reply, so adjust it carefully if
you
-have long running servlets.
+The parameter is the number of milliseconds to wait for success during a read event.
+So this is not a timeout for the complete answer time of a request, but only
+for the maximum time between two packets received from Tomcat. Usually the longest
+pause is between sending the request and getting the first packet of the response.
+<p>
+If the timeout passes without any data received from Tomcat, the webserver will
+no longer wait for the rest of the response and send an error to the client (browser).
+Usually this does not mean, that the request is also aborted on the Tomcat backend.
+If the worker is a member of a load balancer, the load balancer might place the
+worker into an error state and retry the request on another member.
+See also <b>max_reply_timeouts</b>, <b>retries</b> and <b>recovery_options</b>.
+</p>
+<p>
+By default (value zero) the webserver will wait forever which could be an issue for you.
+If you set a reply_timeout, adjust it carefully if you have long running servlets.
+</p>
 <p>
 This features has been added in <b>jk 1.2.6</b> to avoid problem with hung tomcat's
and works on all
 servlet engines supporting ajp13.
-Disabled by default.
+</p>
+</directive>
+
+<directive name="max_reply_timeouts" default="0" required="false">
+Only used for load balancer workers.
+<p>
+If you use a <b>reply_timeout</b> for the members of a load balancer worker,
+and you want to tolerate a few requests taking longer than reply_timeout,
+you can set this attribute to some positive value.
+</p>
+<p>
+Long running requests will still time out after reply_timeout milliseconds waiting for
+data, but the corresponding member worker will only be put into an error state,
+if more than <b>max_reply_timeouts</b> requests have timed out.
+More precisely, the counter for those bad requests will be divided by two,
+whenever the load balancer does its internal maintenance (by default every 60
+seconds).
+</p>
+<p>
+This features has been added in <b>jk 1.2.24</b> to make <b>reply_timeout</b>
less
+sensitive for sporadic long running requests.
 </p>
 </directive>
 



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


Mime
View raw message