You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2007/01/27 16:41:37 UTC

svn commit: r500550 - in /tomcat/connectors/trunk/jk: jkstatus/src/share/org/apache/jk/status/ native/common/ xdocs/miscellaneous/ xdocs/reference/

Author: rjung
Date: Sat Jan 27 07:41:36 2007
New Revision: 500550

URL: http://svn.apache.org/viewvc?view=rev&rev=500550
Log:
Show estimated time until next global maintenance in status worker.
Change displayed time until next recovery to a min/max pair.

Modified:
    tomcat/connectors/trunk/jk/jkstatus/src/share/org/apache/jk/status/JkBalancerMember.java
    tomcat/connectors/trunk/jk/jkstatus/src/share/org/apache/jk/status/JkStatusTask.java
    tomcat/connectors/trunk/jk/native/common/jk_status.c
    tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
    tomcat/connectors/trunk/jk/xdocs/reference/status.xml

Modified: tomcat/connectors/trunk/jk/jkstatus/src/share/org/apache/jk/status/JkBalancerMember.java
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/jkstatus/src/share/org/apache/jk/status/JkBalancerMember.java?view=diff&rev=500550&r1=500549&r2=500550
==============================================================================
--- tomcat/connectors/trunk/jk/jkstatus/src/share/org/apache/jk/status/JkBalancerMember.java (original)
+++ tomcat/connectors/trunk/jk/jkstatus/src/share/org/apache/jk/status/JkBalancerMember.java Sat Jan 27 07:41:36 2007
@@ -88,6 +88,12 @@
     /* possible with > 1.2.20 */
     int time_to_recover = -1 ;
     
+    /* possible with > 1.2.21 */
+    int time_to_recover_max = -1 ;
+    
+    /* possible with > 1.2.21 */
+    int time_to_recover_min = -1 ;
+    
     /**
      * @return Returns the jvm_route.
      * @since mod_jk 1.2.16
@@ -107,22 +113,22 @@
     }
 
     /**
-	 * @return the route
+     * @return the route
     * @since mod_jk 1.2.20
-	 */
-	public String getRoute() {
-		return route;
-	}
+     */
+    public String getRoute() {
+        return route;
+    }
 
-	/**
-	 * @param route the route to set
+    /**
+     * @param route the route to set
     * @since mod_jk 1.2.20
-	 */
-	public void setRoute(String route) {
-		this.route = route;
-	}
+     */
+    public void setRoute(String route) {
+        this.route = route;
+    }
 
-	/**
+    /**
      * @return Returns the address.
      */
     public String getAddress() {
@@ -459,21 +465,52 @@
         this.distance = distance;
     }
 
-	/**
-	 * @return the time_to_recover
+    /**
+     * @return the time_to_recover
      * @since mod_jk 1.2.20
- 	 */
-	public int getTime_to_recover() {
-		return time_to_recover;
-	}
+     */
+    public int getTime_to_recover() {
+        return time_to_recover;
+    }
 
-	/**
-	 * @param time_to_recover the time_to_recover to set
+    /**
+     * @param time_to_recover the time_to_recover to set
      * @since mod_jk 1.2.20
- 	 */
-	public void setTime_to_recover(int time_to_recover) {
-		this.time_to_recover = time_to_recover;
-	}
+     */
+    public void setTime_to_recover(int time_to_recover) {
+        this.time_to_recover = time_to_recover;
+    }
 
+    /**
+     * @return the time_to_recover_min
+     * @since mod_jk 1.2.21
+     */
+    public int getTime_to_recover_min() {
+        return time_to_recover_min;
+    }
+
+    /**
+     * @param time_to_recover_min the time_to_recover_min to set
+     * @since mod_jk 1.2.21
+     */
+    public void setTime_to_recover_min(int time_to_recover_min) {
+        this.time_to_recover_min = time_to_recover_min;
+    }
+
+    /**
+     * @return the time_to_recover_max
+     * @since mod_jk 1.2.21
+     */
+    public int getTime_to_recover_max() {
+        return time_to_recover_max;
+    }
+
+    /**
+     * @param time_to_recover_max the time_to_recover_max to set
+     * @since mod_jk 1.2.21
+     */
+    public void setTime_to_recover_max(int time_to_recover_max) {
+        this.time_to_recover_max = time_to_recover_max;
+    }
 
 }

Modified: tomcat/connectors/trunk/jk/jkstatus/src/share/org/apache/jk/status/JkStatusTask.java
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/jkstatus/src/share/org/apache/jk/status/JkStatusTask.java?view=diff&rev=500550&r1=500549&r2=500550
==============================================================================
--- tomcat/connectors/trunk/jk/jkstatus/src/share/org/apache/jk/status/JkStatusTask.java (original)
+++ tomcat/connectors/trunk/jk/jkstatus/src/share/org/apache/jk/status/JkStatusTask.java Sat Jan 27 07:41:36 2007
@@ -622,6 +622,17 @@
             currentProject.setNewProperty(prefix + ".time_to_recover",
                     Integer.toString(member.getTime_to_recover()));
         }
+        if(member.getTime_to_recover_min() >= 0) {
+            currentProject.setNewProperty(prefix + ".time_to_recover_min",
+                    Integer.toString(member.getTime_to_recover_min()));
+        }
+        if(member.getTime_to_recover_max() >= 0) {
+            currentProject.setNewProperty(prefix + ".time_to_recover_max",
+                    Integer.toString(member.getTime_to_recover_max()));
+            currentProject.setNewProperty(prefix + ".time_to_recover",
+                    (Integer.toString(member.getTime_to_recover_min()) +
+                    Integer.toString(member.getTime_to_recover_max()) / 2);
+        }
             
     }
 
@@ -708,4 +719,4 @@
         }
     }
 
-}
\ No newline at end of file
+}

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=500550&r1=500549&r2=500550
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_status.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_status.c Sat Jan 27 07:41:36 2007
@@ -229,7 +229,7 @@
                                            "<td>%s</td>" \
                                            "<td>%s</td>" \
                                            "<td>%s</td>" \
-                                           "<td>%d</td>" \
+                                           "<td>%d/%d</td>" \
                                            "</tr>\n"
 
 typedef struct status_worker status_worker_t;
@@ -1200,6 +1200,15 @@
     }
 
     map_count = count_maps(s, name, l);
+    int ms_min = lb->maintain_time - (int)difftime(now, lb->s->last_maintain_time);
+    int ms_max = ms_min + lb->maintain_time;
+    ms_min -= JK_LB_MAINTAIN_TOLERANCE;
+    if (ms_min < 0) {
+        ms_min = 0;
+    }
+    if (ms_max < 0) {
+        ms_max = 0;
+    }
 
     if (mime == JK_STATUS_MIME_HTML) {
 
@@ -1233,13 +1242,14 @@
         jk_puts(s, "</table>\n<br/>\n");
 
         jk_puts(s, "<table><tr>"
-                "<th>Good</th><th>Degraded</th><th>Bad/Stopped</th><th>Busy</th><th>Max Busy</th>"
+                "<th>Good</th><th>Degraded</th><th>Bad/Stopped</th><th>Busy</th><th>Max Busy</th><th>Next Maintenance</th>"
                 "</tr>\n<tr>");
         jk_printf(s, "<td>%d</td>", good);
         jk_printf(s, "<td>%d</td>", degraded);
         jk_printf(s, "<td>%d</td>", bad);
         jk_printf(s, "<td>%d</td>", lb->s->busy);
         jk_printf(s, "<td>%d</td>", lb->s->max_busy);
+        jk_printf(s, "<td>%d/%d</td>", ms_min, ms_max);
         jk_puts(s, "</tr>\n</table>\n\n");
 
     }
@@ -1326,11 +1336,17 @@
         for (j = 0; j < lb->num_of_workers; j++) {
             worker_record_t *wr = &(lb->lb_workers[j]);
             ajp_worker_t *a = (ajp_worker_t *)wr->w->worker_private;
-            int rs = 0;
+            int rs_min = 0;
+            int rs_max = 0;
             if (wr->s->state == JK_LB_STATE_ERROR) {
-                rs = lb->maintain_time - (int)difftime(now, lb->s->last_maintain_time);
-                if (rs < lb->recover_wait_time - (int)difftime(now, wr->s->error_time))
-                    rs += lb->maintain_time;
+                rs_min = lb->recover_wait_time - (int)difftime(now, wr->s->error_time);
+                if (rs_min < 0) {
+                    rs_min = 0;
+                }
+                rs_max = rs_min + lb->maintain_time;
+                if (rs_min < ms_min) {
+                    rs_min = ms_min;
+                }
             }
 
             if (mime == JK_STATUS_MIME_HTML) {
@@ -1372,7 +1388,8 @@
                           wr->s->route,
                           wr->s->redirect ? (*wr->s->redirect ? wr->s->redirect : "&nbsp;") : "&nbsp",
                           wr->s->domain ? (*wr->s->domain ? wr->s->domain : "&nbsp;") : "&nbsp",
-                          rs);
+                          rs_min,
+                          rs_max);
 
             }
             else if (mime == JK_STATUS_MIME_XML) {
@@ -1399,7 +1416,8 @@
                 jk_print_xml_att_uint64(s, 8, "read", wr->s->readed);
                 jk_print_xml_att_int(s, 8, "busy", wr->s->busy);
                 jk_print_xml_att_int(s, 8, "max_busy", wr->s->max_busy);
-                jk_print_xml_att_int(s, 8, "time_to_recover", rs < 0 ? 0 : rs);
+                jk_print_xml_att_int(s, 8, "time_to_recover_min", rs_min);
+                jk_print_xml_att_int(s, 8, "time_to_recover_max", rs_max);
                 /* Terminate the tag */
                 jk_print_xml_stop_elt(s, 6, 1);
 
@@ -1428,7 +1446,8 @@
                 jk_printf(s, " read=%" JK_UINT64_T_FMT, wr->s->readed);
                 jk_printf(s, " busy=%d", wr->s->busy);
                 jk_printf(s, " max_busy=%d", wr->s->max_busy);
-                jk_printf(s, " time_to_recover=%d", rs < 0 ? 0 : rs);
+                jk_printf(s, " time_to_recover_min=%d", rs_min);
+                jk_printf(s, " time_to_recover_max=%d", rs_max);
                 jk_puts(s, "\n");
 
             }
@@ -1455,7 +1474,8 @@
                 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);
                 jk_print_prop_att_int(s, w, wr->s->name, "max_busy", wr->s->max_busy);
-                jk_print_prop_att_int(s, w, wr->s->name, "time_to_recover", rs < 0 ? 0 : rs);
+                jk_print_prop_att_int(s, w, wr->s->name, "time_to_recover_min", rs_min);
+                jk_print_prop_att_int(s, w, wr->s->name, "time_to_recover_max", rs_max);
 
             }
         }
@@ -2310,7 +2330,7 @@
             "<tr><th>Max</th><td>Maximum number of busy 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</td></tr>\n"
+            "<tr><th>Rs</th><td>Recovery scheduled in app. min/max seconds</td></tr>\n"
             "</tbody>\n"
             "</table>\n");
     }

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=500550&r1=500549&r2=500550
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Sat Jan 27 07:41:36 2007
@@ -27,6 +27,10 @@
   <subsection name="Native">
     <changelog>
       <add>
+      JkStatus: Show estimated time until next global maintenance.
+      Change displayed time until next recovery to a min/max pair. (rjung)
+      </add>
+      <add>
       JkStatus: Allow a user of a read/write status worker to switch it
       to and from read_only mode temporarily. (rjung)
       </add>

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=500550&r1=500549&r2=500550
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/reference/status.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/reference/status.xml Sat Jan 27 07:41:36 2007
@@ -73,7 +73,7 @@
 or one of its members.
 </li>
 <li>
-<b>recover</b>: Mark a member of a load balancer, that is in error state, for recovery.
+<b>recover</b>: Mark a member of a load balancer, that is in error state, for immediate recovery.
 </li>
 <li>
 <b>version</b>: only show version information of the web server and the JK software



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