You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2009/12/22 19:09:20 UTC

svn commit: r893253 - in /tomcat/jk/trunk/native/common: jk_ajp_common.c jk_shm.h jk_status.c

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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r893253 - in /tomcat/jk/trunk/native/common: jk_ajp_common.c jk_shm.h jk_status.c

Posted by Mladen Turk <mt...@apache.org>.
On 12/22/2009 08:28 PM, Rainer Jung wrote:
> On 22.12.2009 20:05, Mladen Turk wrote:
>
> I have a tendency to not put to much new stuff in 29 because it would be
> nice to have a stable release with only bug fixes. Adding stuff to the
> watchdog might be nice for a not to far 30 release?
>

Of course.


Regards
-- 
^TM

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


Re: svn commit: r893253 - in /tomcat/jk/trunk/native/common: jk_ajp_common.c jk_shm.h jk_status.c

Posted by Rainer Jung <ra...@kippdata.de>.
On 22.12.2009 20:05, Mladen Turk wrote:
> On 12/22/2009 07:18 PM, Rainer Jung wrote:
>> On 22.12.2009 19:09, mturk@apache.org wrote:
>>> Something missing and hard to guess. The total number of currently
>>> opened connection per worker
>>
>> Cool!
>
> Even more cool option would be the mechanism to
> close all those connection from status.
> Possible only if JkWatchdogInterval is set, so
> think I'll add that option either Reset or add
> a new command (Recycle)

Now that we have the signalling we can

- indicate that connections should get closed via shm
   but that still would wait until the other processes
   recognize it
- or yes: the watchdog can close

I have a tendency to not put to much new stuff in 29 because it would be 
nice to have a stable release with only bug fixes. Adding stuff to the 
watchdog might be nice for a not to far 30 release?

Regards,

Rainer

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


Re: svn commit: r893253 - in /tomcat/jk/trunk/native/common: jk_ajp_common.c jk_shm.h jk_status.c

Posted by Mladen Turk <mt...@apache.org>.
On 12/22/2009 07:18 PM, Rainer Jung wrote:
> On 22.12.2009 19:09, mturk@apache.org wrote:
>> Something missing and hard to guess. The total number of currently
>> opened connection per worker
>
> Cool!

Even more cool option would be the mechanism to
close all those connection from status.
Possible only if JkWatchdogInterval is set, so
think I'll add that option either Reset or add
a new command (Recycle)


Regards
-- 
^TM

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


Re: svn commit: r893253 - in /tomcat/jk/trunk/native/common: jk_ajp_common.c jk_shm.h jk_status.c

Posted by Mladen Turk <mt...@apache.org>.
On 12/22/2009 07:18 PM, Rainer Jung wrote:
> On 22.12.2009 19:09, mturk@apache.org wrote:
>> Something missing and hard to guess. The total number of currently
>> opened connection per worker
>
> Cool!

Right, It's actually amazing
ab -c 10 -n 1000 ...
with event mpm opens 24+ connections



Regards
-- 
^TM

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


Re: svn commit: r893253 - in /tomcat/jk/trunk/native/common: jk_ajp_common.c jk_shm.h jk_status.c

Posted by Rainer Jung <ra...@kippdata.de>.
On 22.12.2009 19:09, mturk@apache.org wrote:
> Something missing and hard to guess. The total number of currently opened connection per worker

Cool!

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