tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r1174411 - in /tomcat/jk/trunk: native/common/jk_lb_worker.c native/common/jk_lb_worker.h native/common/jk_shm.h native/common/jk_status.c xdocs/miscellaneous/changelog.xml xdocs/reference/apache.xml
Date Thu, 22 Sep 2011 22:03:36 GMT
Author: rjung
Date: Thu Sep 22 22:03:35 2011
New Revision: 1174411

URL: http://svn.apache.org/viewvc?rev=1174411&view=rev
Log:
Add counter for created sessions to status worker
and HTTPD notes. It actually counts the number of
requests that do not carry a session id.
Only available when using a load balancer worker.

Modified:
    tomcat/jk/trunk/native/common/jk_lb_worker.c
    tomcat/jk/trunk/native/common/jk_lb_worker.h
    tomcat/jk/trunk/native/common/jk_shm.h
    tomcat/jk/trunk/native/common/jk_status.c
    tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
    tomcat/jk/trunk/xdocs/reference/apache.xml

Modified: tomcat/jk/trunk/native/common/jk_lb_worker.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.c?rev=1174411&r1=1174410&r2=1174411&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_lb_worker.c (original)
+++ tomcat/jk/trunk/native/common/jk_lb_worker.c Thu Sep 22 22:03:35 2011
@@ -93,6 +93,7 @@ static const char *lb_first_log_names[] 
     JK_NOTE_LB_FIRST_NAME,
     JK_NOTE_LB_FIRST_VALUE,
     JK_NOTE_LB_FIRST_ACCESSED,
+    JK_NOTE_LB_FIRST_SESSIONS,
     JK_NOTE_LB_FIRST_READ,
     JK_NOTE_LB_FIRST_TRANSFERRED,
     JK_NOTE_LB_FIRST_ERRORS,
@@ -106,6 +107,7 @@ static const char *lb_last_log_names[] =
     JK_NOTE_LB_LAST_NAME,
     JK_NOTE_LB_LAST_VALUE,
     JK_NOTE_LB_LAST_ACCESSED,
+    JK_NOTE_LB_LAST_SESSIONS,
     JK_NOTE_LB_LAST_READ,
     JK_NOTE_LB_LAST_TRANSFERRED,
     JK_NOTE_LB_LAST_ERRORS,
@@ -1042,25 +1044,29 @@ static void lb_add_log_items(jk_ws_servi
         /* JK_NOTE_LB_FIRST/LAST_ACCESSED */
         log_values[2] = buf;
         buf += JK_LB_UINT64_STR_SZ;
+        snprintf(buf, JK_LB_UINT64_STR_SZ, "%" JK_UINT64_T_FMT, w->s->sessions);
+        /* JK_NOTE_LB_FIRST/LAST_SESSIONS */
+        log_values[3] = buf;
+        buf += JK_LB_UINT64_STR_SZ;
         snprintf(buf, JK_LB_UINT64_STR_SZ, "%" JK_UINT64_T_FMT, aw->s->readed);
         /* JK_NOTE_LB_FIRST/LAST_READ */
-        log_values[3] = buf;
+        log_values[4] = buf;
         buf += JK_LB_UINT64_STR_SZ;
         snprintf(buf, JK_LB_UINT64_STR_SZ, "%" JK_UINT64_T_FMT, aw->s->transferred);
         /* JK_NOTE_LB_FIRST/LAST_TRANSFERRED */
-        log_values[4] = buf;
+        log_values[5] = buf;
         buf += JK_LB_UINT64_STR_SZ;
         snprintf(buf, JK_LB_UINT64_STR_SZ, "%" JK_UINT32_T_FMT, w->s->errors);
         /* JK_NOTE_LB_FIRST/LAST_ERRORS */
-        log_values[5] = buf;
+        log_values[6] = buf;
         buf += JK_LB_UINT64_STR_SZ;
         snprintf(buf, JK_LB_UINT64_STR_SZ, "%d", aw->s->busy);
         /* JK_NOTE_LB_FIRST/LAST_BUSY */
-        log_values[6] = buf;
+        log_values[7] = buf;
         /* JK_NOTE_LB_FIRST/LAST_ACTIVATION */
-        log_values[7] = jk_lb_get_activation(w, l);
+        log_values[8] = jk_lb_get_activation(w, l);
         /* JK_NOTE_LB_FIRST/LAST_STATE */
-        log_values[8] = jk_lb_get_state(w, l);
+        log_values[9] = jk_lb_get_state(w, l);
         s->add_log_items(s, log_names, log_values, JK_LB_NOTES_COUNT);
     }
 }
@@ -1240,6 +1246,9 @@ static int JK_METHOD service(jk_endpoint
                      (p->worker->lbmethod == JK_LB_METHOD_SESSIONS ||
                       p->worker->lbmethod == JK_LB_METHOD_NEXT)))
                     rec->s->lb_value += rec->lb_mult;
+                if (!sessionid) {
+                    rec->s->sessions++;
+                }
                 if (p->worker->lblock == JK_LB_LOCK_PESSIMISTIC)
                     jk_shm_unlock();
 
@@ -1604,6 +1613,8 @@ static int JK_METHOD validate(jk_worker_
                 p->lb_workers[i].s->lb_value = 0;
                 p->lb_workers[i].s->state = JK_LB_STATE_IDLE;
                 p->lb_workers[i].s->error_time = 0;
+                p->lb_workers[i].s->elected_snapshot = 0;
+                p->lb_workers[i].s->sessions = 0;
                 p->lb_workers[i].activation =
                     jk_get_worker_activation(props, worker_names[i]);
                 if (!wc_create_worker(p->lb_workers[i].name, 0,

Modified: tomcat/jk/trunk/native/common/jk_lb_worker.h
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.h?rev=1174411&r1=1174410&r2=1174411&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_lb_worker.h (original)
+++ tomcat/jk/trunk/native/common/jk_lb_worker.h Thu Sep 22 22:03:35 2011
@@ -103,10 +103,11 @@ extern "C"
 #define JK_LB_ACTIVATION_TEXT_DEF      (JK_LB_ACTIVATION_TEXT_ACTIVE)
 
 #define JK_LB_UINT64_STR_SZ          (21)
-#define JK_LB_NOTES_COUNT            (9)
+#define JK_LB_NOTES_COUNT            (10)
 #define JK_NOTE_LB_FIRST_NAME        ("JK_LB_FIRST_NAME")
 #define JK_NOTE_LB_FIRST_VALUE       ("JK_LB_FIRST_VALUE")
 #define JK_NOTE_LB_FIRST_ACCESSED    ("JK_LB_FIRST_ACCESSED")
+#define JK_NOTE_LB_FIRST_SESSIONS    ("JK_LB_FIRST_SESSIONS")
 #define JK_NOTE_LB_FIRST_READ        ("JK_LB_FIRST_READ")
 #define JK_NOTE_LB_FIRST_TRANSFERRED ("JK_LB_FIRST_TRANSFERRED")
 #define JK_NOTE_LB_FIRST_ERRORS      ("JK_LB_FIRST_ERRORS")
@@ -116,6 +117,7 @@ extern "C"
 #define JK_NOTE_LB_LAST_NAME         ("JK_LB_LAST_NAME")
 #define JK_NOTE_LB_LAST_VALUE        ("JK_LB_LAST_VALUE")
 #define JK_NOTE_LB_LAST_ACCESSED     ("JK_LB_LAST_ACCESSED")
+#define JK_NOTE_LB_LAST_SESSIONS     ("JK_LB_LAST_SESSIONS")
 #define JK_NOTE_LB_LAST_READ         ("JK_LB_LAST_READ")
 #define JK_NOTE_LB_LAST_TRANSFERRED  ("JK_LB_LAST_TRANSFERRED")
 #define JK_NOTE_LB_LAST_ERRORS       ("JK_LB_LAST_ERRORS")

Modified: tomcat/jk/trunk/native/common/jk_shm.h
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_shm.h?rev=1174411&r1=1174410&r2=1174411&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_shm.h (original)
+++ tomcat/jk/trunk/native/common/jk_shm.h Thu Sep 22 22:03:35 2011
@@ -151,6 +151,8 @@ struct jk_shm_lb_sub_worker
     volatile time_t error_time;
     /* Number of times the worker was elected - snapshot during maintenance */
     volatile jk_uint64_t  elected_snapshot;
+    /* Number of non-sticky requests handled, that were not marked as stateless */
+    volatile jk_uint64_t  sessions;
     /* Number of non 200 responses */
     volatile jk_uint32_t  errors;
 };

Modified: tomcat/jk/trunk/native/common/jk_status.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_status.c?rev=1174411&r1=1174410&r2=1174411&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_status.c (original)
+++ tomcat/jk/trunk/native/common/jk_status.c Thu Sep 22 22:03:35 2011
@@ -306,7 +306,7 @@
                                            "<th>&nbsp;</th><th>Name</th>"
\
                                            "<th>Act</th><th>State</th>"
\
                                            "<th>D</th><th>F</th><th>M</th>"
\
-                                           "<th>V</th><th>Acc</th>"
\
+                                           "<th>V</th><th>Acc</th><th>Sess</th>"
\
                                            "<th>Err</th><th>CE</th><th>RE</th>"
\
                                            "<th>Wr</th><th>Rd</th><th>Busy</th><th>Max</th><th>Con</th>"
\
                                            "<th>" JK_STATUS_ARG_LBM_TEXT_ROUTE "</th>"
\
@@ -320,6 +320,7 @@
                                            "<td>%" JK_UINT64_T_FMT "</td>" \
                                            "<td>%" JK_UINT64_T_FMT "</td>" \
                                            "<td>%" JK_UINT64_T_FMT " (%d/sec)</td>"
\
+                                           "<td>%" JK_UINT64_T_FMT " (%d/sec)</td>"
\
                                            "<td>%" JK_UINT32_T_FMT "</td>" \
                                            "<td>%" JK_UINT32_T_FMT "</td>" \
                                            "<td>%" JK_UINT32_T_FMT "</td>" \
@@ -1831,6 +1832,8 @@ static void display_worker_ajp_details(j
                       wr->s->lb_value,
                       aw->s->used,
                       delta_reset > 0 ? (int)(aw->s->used / delta_reset) : -1,
+                      wr->s->sessions,
+                      delta_reset > 0 ? (int)(wr->s->sessions / delta_reset) : -1,
                       wr->s->errors,
                       aw->s->client_errors,
                       aw->s->reply_timeouts,
@@ -1906,6 +1909,7 @@ static void display_worker_ajp_details(j
             jk_print_xml_att_uint64(s, off+2, "lbmult", wr->lb_mult);
             jk_print_xml_att_uint64(s, off+2, "lbvalue", wr->s->lb_value);
             jk_print_xml_att_uint64(s, off+2, "elected", aw->s->used);
+            jk_print_xml_att_uint64(s, off+2, "sessions", wr->s->sessions);
             jk_print_xml_att_uint32(s, off+2, "errors", wr->s->errors);
         }
         else {
@@ -1972,6 +1976,7 @@ static void display_worker_ajp_details(j
             jk_printf(s, " lbmult=%" JK_UINT64_T_FMT, wr->lb_mult);
             jk_printf(s, " lbvalue=%" JK_UINT64_T_FMT, wr->s->lb_value);
             jk_printf(s, " elected=%" JK_UINT64_T_FMT, aw->s->used);
+            jk_printf(s, " sessions=%" JK_UINT64_T_FMT, wr->s->sessions);
             jk_printf(s, " errors=%" JK_UINT32_T_FMT, wr->s->errors);
         }
         else {
@@ -2035,6 +2040,7 @@ static void display_worker_ajp_details(j
             jk_print_prop_att_uint64(s, w, ajp_name, "lbmult", wr->lb_mult);
             jk_print_prop_att_uint64(s, w, ajp_name, "lbvalue", wr->s->lb_value);
             jk_print_prop_att_uint64(s, w, ajp_name, "elected", aw->s->used);
+            jk_print_prop_att_uint64(s, w, ajp_name, "sessions", wr->s->sessions);
             jk_print_prop_att_uint32(s, w, ajp_name, "errors", wr->s->errors);
         }
         else {
@@ -3700,6 +3706,7 @@ static void display_legend(jk_ws_service
             "<tr><th>M</th><td>Load Balancer multiplicity</td></tr>\n"
             "<tr><th>V</th><td>Load Balancer value</td></tr>\n"
             "<tr><th>Acc</th><td>Number of requests</td></tr>\n"
+            "<tr><th>Sess</th><td>Number of sessions created</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"
@@ -4273,6 +4280,7 @@ static int reset_worker(jk_ws_service_t 
                 aw = (ajp_worker_t *)wr->worker->worker_private;
                 wr->s->state            = JK_LB_STATE_IDLE;
                 wr->s->elected_snapshot = 0;
+                wr->s->sessions         = 0;
                 wr->s->error_time       = 0;
                 wr->s->errors           = 0;
                 wr->s->lb_value         = 0;
@@ -4300,6 +4308,7 @@ static int reset_worker(jk_ws_service_t 
             aw = (ajp_worker_t *)wr->worker->worker_private;
             wr->s->state            = JK_LB_STATE_IDLE;
             wr->s->elected_snapshot = 0;
+            wr->s->sessions         = 0;
             wr->s->error_time       = 0;
             wr->s->errors           = 0;
             wr->s->lb_value         = 0;

Modified: tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml?rev=1174411&r1=1174410&r2=1174411&view=diff
==============================================================================
--- tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/jk/trunk/xdocs/miscellaneous/changelog.xml Thu Sep 22 22:03:35 2011
@@ -57,6 +57,11 @@
         LB: New balancing method "Next" to distribute sessions in a round-robin
         way. (rjung)
       </add>
+      <add>
+        LB: Add counter for created sessions to status worker and HTTPD notes.
+        It actually counts the number of requests that do not carry a session id.
+        (rjung)
+      </add>
     </changelog>
   </subsection>
 </section>

Modified: tomcat/jk/trunk/xdocs/reference/apache.xml
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/xdocs/reference/apache.xml?rev=1174411&r1=1174410&r2=1174411&view=diff
==============================================================================
--- tomcat/jk/trunk/xdocs/reference/apache.xml (original)
+++ tomcat/jk/trunk/xdocs/reference/apache.xml Thu Sep 22 22:03:35 2011
@@ -599,6 +599,7 @@ Most of them are are only useful in comb
   <attribute name="JK_LB_FIRST_NAME" required="false">Load-Balancer: Name of the first
worker tried</attribute>
   <attribute name="JK_LB_FIRST_TYPE" required="false">Load-Balancer: Type of the first
worker tried</attribute>
   <attribute name="JK_LB_FIRST_ACCESSED" required="false">Load-Balancer: Access count
for the first worker tried</attribute>
+  <attribute name="JK_LB_FIRST_SESSIONS" required="false">Load-Balancer: Count of created
sessions for the first worker tried</attribute>
   <attribute name="JK_LB_FIRST_READ" required="false">Load-Balancer: Bytes read for
the first worker tried</attribute>
   <attribute name="JK_LB_FIRST_TRANSFERRED" required="false">Load-Balancer: Bytes transferred
for the first worker tried</attribute>
   <attribute name="JK_LB_FIRST_ERRORS" required="false">Load-Balancer: Error count
for the first worker tried</attribute>
@@ -608,6 +609,7 @@ Most of them are are only useful in comb
   <attribute name="JK_LB_LAST_NAME" required="false">Load-Balancer: Name of the last
worker tried</attribute>
   <attribute name="JK_LB_LAST_TYPE" required="false">Load-Balancer: Type of the last
worker tried</attribute>
   <attribute name="JK_LB_LAST_ACCESSED" required="false">Load-Balancer: Access count
for the last worker tried</attribute>
+  <attribute name="JK_LB_LAST_SESSIONS" required="false">Load-Balancer: Count of created
sessions for the last worker tried</attribute>
   <attribute name="JK_LB_LAST_READ" required="false">Load-Balancer: Bytes read for
the last worker tried</attribute>
   <attribute name="JK_LB_LAST_TRANSFERRED" required="false">Load-Balancer: Bytes transferred
for the last worker tried</attribute>
   <attribute name="JK_LB_LAST_ERRORS" required="false">Load-Balancer: Error count for
the last worker tried</attribute>



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


Mime
View raw message