Author: mturk
Date: Tue Dec 22 18:09:19 2009
New Revision: 893253

URL: http://svn.apache.org/viewvc?rev=893253&view=rev
Log:
Something missing and hard to guess. The total number of currently opened 
connection per worker

Modified:
    tomcat/jk/trunk/native/common/jk_ajp_common.c
    tomcat/jk/trunk/native/common/jk_shm.h
    tomcat/jk/trunk/native/common/jk_status.c

Modified: tomcat/jk/trunk/native/common/jk_ajp_common.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_ajp_common.c?rev=893253&r1=893252&r2=893253&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_ajp_common.c (original)
+++ tomcat/jk/trunk/native/common/jk_ajp_common.c Tue Dec 22 18:09:19 2009
@@ -747,6 +747,7 @@
         jk_shutdown_socket(ae->sd, l);
         ae->sd = JK_INVALID_SOCKET;
         ae->last_op = JK_AJP13_END_RESPONSE;
+        ae->worker->s->connected--;
     }
     jk_reset_pool(&(ae->pool));
     JK_TRACE_EXIT(l);
@@ -953,7 +954,7 @@
         JK_TRACE_EXIT(l);
         return JK_FALSE;
     }
-
+    ae->worker->s->connected++;
     ae->last_errno = 0;
     if (JK_IS_DEBUG_LEVEL(l)) {
         jk_log(l, JK_LOG_DEBUG,
@@ -977,6 +978,7 @@
             jk_shutdown_socket(ae->sd, l);
             ae->sd = JK_INVALID_SOCKET;
             ae->last_op = JK_AJP13_END_RESPONSE;
+            ae->worker->s->connected--;
         }
     }
     /* XXX: Should we send a cping also after logon to validate the 
connection? */
@@ -1125,6 +1127,7 @@
         jk_shutdown_socket(ae->sd, l);
         ae->sd = JK_INVALID_SOCKET;
         ae->last_op = JK_AJP13_END_RESPONSE;
+        ae->worker->s->connected--;
         JK_TRACE_EXIT(l);
         return JK_FATAL_ERROR;
     }
@@ -1145,7 +1148,7 @@
            ae->sd, rc, ae->last_errno);
     ae->sd = JK_INVALID_SOCKET;
     ae->last_op = JK_AJP13_END_RESPONSE;
-
+    ae->worker->s->connected--;
     JK_TRACE_EXIT(l);
     return JK_FALSE;
 }
@@ -1198,6 +1201,7 @@
         }
         ae->sd = JK_INVALID_SOCKET;
         ae->last_op = JK_AJP13_END_RESPONSE;
+        ae->worker->s->connected--;
         JK_TRACE_EXIT(l);
         return JK_FALSE;
     }
@@ -1223,6 +1227,7 @@
             jk_shutdown_socket(ae->sd, l);
             ae->sd = JK_INVALID_SOCKET;
             ae->last_op = JK_AJP13_END_RESPONSE;
+            ae->worker->s->connected--;
             JK_TRACE_EXIT(l);
             return JK_AJP_PROTOCOL_ERROR;
         }
@@ -1246,6 +1251,7 @@
             jk_shutdown_socket(ae->sd, l);
             ae->sd = JK_INVALID_SOCKET;
             ae->last_op = JK_AJP13_END_RESPONSE;
+            ae->worker->s->connected--;
             JK_TRACE_EXIT(l);
             return JK_AJP_PROTOCOL_ERROR;
         }
@@ -1264,6 +1270,7 @@
         jk_shutdown_socket(ae->sd, l);
         ae->sd = JK_INVALID_SOCKET;
         ae->last_op = JK_AJP13_END_RESPONSE;
+        ae->worker->s->connected--;
         JK_TRACE_EXIT(l);
         return JK_AJP_PROTOCOL_ERROR;
     }
@@ -1294,6 +1301,7 @@
         }
         ae->sd = JK_INVALID_SOCKET;
         ae->last_op = JK_AJP13_END_RESPONSE;
+        ae->worker->s->connected--;
         JK_TRACE_EXIT(l);
         /* Although we have a connection, this is effectively a protocol error.
          * We received the AJP header packet, but not the packet payload
@@ -1465,6 +1473,7 @@
         jk_shutdown_socket(ae->sd, l);
         ae->sd = JK_INVALID_SOCKET;
         ae->last_op = JK_AJP13_END_RESPONSE;
+        ae->worker->s->connected--;
     }
     /*
      * First try to check open connections...
@@ -1479,6 +1488,7 @@
                    ae->worker->name, ae->sd, ae->last_errno);
             ae->sd = JK_INVALID_SOCKET;
             ae->last_op = JK_AJP13_END_RESPONSE;
+            ae->worker->s->connected--;
             err = JK_TRUE;
             err_conn++;
         }
@@ -1999,6 +2009,7 @@
                 /* We can't trust this connection any more. */
                 jk_shutdown_socket(p->sd, l);
                 p->sd = JK_INVALID_SOCKET;
+                p->worker->s->connected--;
                 if (headeratclient == JK_FALSE) {
                     if (p->worker->recovery_opts & 
RECOVER_ABORT_IF_TCGETREQUEST)
                         op->recoverable = JK_FALSE;

Modified: tomcat/jk/trunk/native/common/jk_shm.h
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_shm.h?rev=893253&r1=893252&r2=893253&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_shm.h (original)
+++ tomcat/jk/trunk/native/common/jk_shm.h Tue Dec 22 18:09:19 2009
@@ -95,6 +95,8 @@
     /* current error state (runtime) of the worker */
     volatile int state;
     /* Statistical data */
+    /* Number of currently connected channels */
+    volatile int connected;
     /* Number of currently busy channels */
     volatile int busy;
     /* Maximum number of busy channels */

Modified: tomcat/jk/trunk/native/common/jk_status.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_status.c?rev=893253&r1=893252&r2=893253&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_status.c (original)
+++ tomcat/jk/trunk/native/common/jk_status.c Tue Dec 22 18:09:19 2009
@@ -263,7 +263,7 @@
                                            "<th>State</th>" \
                                            "<th>Acc</th>" \
                                            
"<th>Err</th><th>CE</th><th>RE</th>" \
-                                           
"<th>Wr</th><th>Rd</th><th>Busy</th><th>Max</th><th>LR</th><th>LE</th>" \
+                                           
"<th>Wr</th><th>Rd</th><th>Busy</th><th>Max</th><th>Con</th><th>LR</th><th>LE</th>"
 \
                                            "</tr>\n"
 #define JK_STATUS_SHOW_AJP_ROW             "<tr>" \
                                            "<td>%s</td>" \
@@ -276,6 +276,7 @@
                                            "<td>%d</td>" \
                                            "<td>%d</td>" \
                                            "<td>%d</td>" \
+                                           "<td>%d</td>" \
                                            "<td>%s</td>" \
                                            "</tr>\n"
 #define JK_STATUS_SHOW_LB_HEAD             "<tr>" \
@@ -307,7 +308,7 @@
                                            "<th>D</th><th>F</th><th>M</th>" \
                                            "<th>V</th><th>Acc</th>" \
                                            
"<th>Err</th><th>CE</th><th>RE</th>" \
-                                           
"<th>Wr</th><th>Rd</th><th>Busy</th><th>Max</th>" \
+                                           
"<th>Wr</th><th>Rd</th><th>Busy</th><th>Max</th><th>Con</th>" \
                                            "<th>" JK_STATUS_ARG_LBM_TEXT_ROUTE 
"</th>" \
                                            
"<th>RR</th><th>Cd</th><th>Rs</th><th>LR</th><th>LE</th>" \
                                            "</tr>\n"
@@ -326,6 +327,7 @@
                                            "<td>%s (%s/sec)</td>" \
                                            "<td>%d</td>" \
                                            "<td>%d</td>" \
+                                           "<td>%d</td>" \
                                            "<td>%s</td>" \
                                            "<td>%s</td>" \
                                            "<td>%s</td>" \
@@ -1833,6 +1835,7 @@
                       delta_reset > 0 ? status_strfsize(aw->s->readed / 
delta_reset , buf_rd_sec) : "-",
                       aw->s->busy,
                       aw->s->max_busy,
+                      aw->s->connected,
                       wr->route,
                       wr->redirect ? (*wr->redirect ? wr->redirect : "&nbsp;") 
: "&nbsp",
                       wr->domain ? (*wr->domain ? wr->domain : "&nbsp;") : 
"&nbsp",
@@ -1854,6 +1857,7 @@
                       delta_reset > 0 ? status_strfsize(aw->s->readed / 
delta_reset , buf_rd_sec) : "-",
                       aw->s->busy,
                       aw->s->max_busy,
+                      aw->s->connected,
                       delta_reset,
                       rc_time > 0 ? buf_time : "&nbsp;");
         }
@@ -1909,6 +1913,7 @@
         jk_print_xml_att_uint64(s, off+2, "read", aw->s->readed);
         jk_print_xml_att_int(s, off+2, "busy", aw->s->busy);
         jk_print_xml_att_int(s, off+2, "max_busy", aw->s->max_busy);
+        jk_print_xml_att_int(s, off+2, "connected", aw->s->connected);
         if (lb) {
             jk_print_xml_att_int(s, off+2, "time_to_recover_min", rs_min);
             jk_print_xml_att_int(s, off+2, "time_to_recover_max", rs_max);
@@ -1974,6 +1979,7 @@
         jk_printf(s, " read=%" JK_UINT64_T_FMT, aw->s->readed);
         jk_printf(s, " busy=%d", aw->s->busy);
         jk_printf(s, " max_busy=%d", aw->s->max_busy);
+        jk_printf(s, " connected=%d", aw->s->connected);
         if (lb) {
             jk_printf(s, " time_to_recover_min=%d", rs_min);
             jk_printf(s, " time_to_recover_max=%d", rs_max);
@@ -2036,6 +2042,7 @@
         jk_print_prop_att_uint64(s, w, ajp_name, "read", aw->s->readed);
         jk_print_prop_att_int(s, w, ajp_name, "busy", aw->s->busy);
         jk_print_prop_att_int(s, w, ajp_name, "max_busy", aw->s->max_busy);
+        jk_print_prop_att_int(s, w, ajp_name, "connected", aw->s->connected);
         if (lb) {
             jk_print_prop_att_int(s, w, ajp_name, "time_to_recover_min", 
rs_min);
             jk_print_prop_att_int(s, w, ajp_name, "time_to_recover_max", 
rs_max);
@@ -3688,6 +3695,7 @@
             "<tr><th>Rd</th><td>Number of bytes read</td></tr>\n"
             "<tr><th>Busy</th><td>Current number of busy 
connections</td></tr>\n"
             "<tr><th>Max</th><td>Maximum number of busy 
connections</td></tr>\n"
+            "<tr><th>Con</th><td>Current number of backend 
connections</td></tr>\n"
             "<tr><th>RR</th><td>Route redirect</td></tr>\n"
             "<tr><th>Cd</th><td>Cluster domain</td></tr>\n"
             "<tr><th>Rs</th><td>Recovery scheduled in app. min/max 
seconds</td></tr>\n"



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

Reply via email to