[CalendarServer-changes] [15389] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Mon Dec 14 12:48:18 PST 2015


Revision: 15389
          http://trac.calendarserver.org//changeset/15389
Author:   cdaboo at apple.com
Date:     2015-12-14 12:48:17 -0800 (Mon, 14 Dec 2015)
Log Message:
-----------
dashboard can now track the maximum HTTP slot usage over the stats intervals.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/accesslog.py
    CalendarServer/trunk/calendarserver/dashboard_service.py
    CalendarServer/trunk/calendarserver/tools/dashview.py
    CalendarServer/trunk/txweb2/metafd.py

Modified: CalendarServer/trunk/calendarserver/accesslog.py
===================================================================
--- CalendarServer/trunk/calendarserver/accesslog.py	2015-12-14 20:12:56 UTC (rev 15388)
+++ CalendarServer/trunk/calendarserver/accesslog.py	2015-12-14 20:48:17 UTC (rev 15389)
@@ -473,6 +473,7 @@
             "t"          : 0.0,
             "t-resp-wr"  : 0.0,
             "slots"      : 0,
+            "max-slots"  : 0,
             "T"          : initTimeHistogram(),
             "T-RESP-WR"  : initTimeHistogram(),
             "T-MAX"      : 0.0,
@@ -499,6 +500,7 @@
         current["t"] += stats.get("t", 0.0)
         current["t-resp-wr"] += stats.get("t-resp-wr", 0.0)
         current["slots"] += stats.get("outstandingRequests", 0)
+        current["max-slots"] = max(current["max-slots"], self.limiter.maxOutstandingRequests if hasattr(self, "limiter") else 0)
         current["cpu"] += self.systemStats.items["cpu use"]
 
         def histogramUpdate(t, key):
@@ -548,6 +550,7 @@
         current["t"] += stats["t"]
         current["t-resp-wr"] += stats["t-resp-wr"]
         current["slots"] += stats["slots"]
+        current["max-slots"] = max(current["max-slots"], stats["max-slots"])
         current["cpu"] += stats["cpu"]
 
         def histogramUpdate(t, key):

Modified: CalendarServer/trunk/calendarserver/dashboard_service.py
===================================================================
--- CalendarServer/trunk/calendarserver/dashboard_service.py	2015-12-14 20:12:56 UTC (rev 15388)
+++ CalendarServer/trunk/calendarserver/dashboard_service.py	2015-12-14 20:48:17 UTC (rev 15389)
@@ -209,6 +209,7 @@
     def __init__(self, logObserver, limiter):
         self.logger = logObserver
         self.limiter = limiter
+        self.logger.limiter = self.limiter
         self.store = None
         self.directory = None
 

Modified: CalendarServer/trunk/calendarserver/tools/dashview.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dashview.py	2015-12-14 20:12:56 UTC (rev 15388)
+++ CalendarServer/trunk/calendarserver/tools/dashview.py	2015-12-14 20:48:17 UTC (rev 15389)
@@ -401,7 +401,7 @@
         """
         if len(self.currentData) == 0:
             self.update()
-        return self.currentData["pods"][pod][server][item]
+        return self.currentData["pods"][pod][server].get(item)
 
 
 
@@ -755,7 +755,7 @@
     clientItem = "stats"
 
     windowTitle = "Request Statistics"
-    formatWidth = 84
+    formatWidth = 92
     additionalRows = 4
 
     def updateRowCount(self):
@@ -766,11 +766,11 @@
         records = defaultIfNone(self.clientData(), {})
         self.iter += 1
 
-        s1 = " {:<8}{:>8}{:>10}{:>10}{:>10}{:>10}{:>8}{:>8}{:>8} ".format(
-            "Period", "Reqs", "Av-Reqs", "Av-Resp", "Av-NoWr", "Max-Resp", "Slot", "CPU ", "500's"
+        s1 = " {:<8}{:>8}{:>10}{:>10}{:>10}{:>10}{:>8}{:>8}{:>8}{:>8} ".format(
+            "Period", "Reqs", "Av-Reqs", "Av-Resp", "Av-NoWr", "Max-Resp", "Slot", "Slot", "CPU ", "500's"
         )
-        s2 = " {:<8}{:>8}{:>10}{:>10}{:>10}{:>10}{:>8}{:>8}{:>8} ".format(
-            "", "", "per sec", "(ms)", "(ms)", "(ms)", "Avg.", "Avg.", ""
+        s2 = " {:<8}{:>8}{:>10}{:>10}{:>10}{:>10}{:>8}{:>8}{:>8}{:>8} ".format(
+            "", "", "per sec", "(ms)", "(ms)", "(ms)", "Avg.", "Max", "Avg.", ""
         )
         pt = self.tableHeader((s1, s2,), len(records))
 
@@ -784,7 +784,7 @@
                 "cpu": 0.0,
                 "500": 0,
             })
-            s = " {:<8}{:>8}{:>10.1f}{:>10.1f}{:>10.1f}{:>10.1f}{:>8.2f}{:>7.1f}%{:>8} ".format(
+            s = " {:<8}{:>8}{:>10.1f}{:>10.1f}{:>10.1f}{:>10.1f}{:>8.2f}{:>8}{:>7.1f}%{:>8} ".format(
                 key,
                 stat["requests"],
                 safeDivision(float(stat["requests"]), seconds),
@@ -792,6 +792,7 @@
                 safeDivision(stat["t"] - stat["t-resp-wr"], stat["requests"]),
                 stat["T-MAX"],
                 safeDivision(float(stat["slots"]), stat["requests"]),
+                stat["max-slots"],
                 safeDivision(stat["cpu"], stat["requests"]),
                 stat["500"],
             )

Modified: CalendarServer/trunk/txweb2/metafd.py
===================================================================
--- CalendarServer/trunk/txweb2/metafd.py	2015-12-14 20:12:56 UTC (rev 15388)
+++ CalendarServer/trunk/txweb2/metafd.py	2015-12-14 20:48:17 UTC (rev 15389)
@@ -320,6 +320,7 @@
     """
 
     _outstandingRequests = 0
+    _maxOutstandingRequests = 0
 
     def __init__(self, maxAccepts, maxRequests):
         """
@@ -429,6 +430,7 @@
         current = sum(status.effective()
                       for status in self.dispatcher.statuses)
         self._outstandingRequests = current # preserve for or= field in log
+        self._maxOutstandingRequests = max(self._maxOutstandingRequests, self._outstandingRequests)
         maximum = self.maxRequests
         overloaded = (current >= maximum)
         available = len(filter(lambda x: x.active(), self.dispatcher.statuses))
@@ -445,7 +447,18 @@
         return self._outstandingRequests
 
 
+    @property # make read-only
+    def maxOutstandingRequests(self):
+        """
+        Reset the max value to the current outstanding value every time the max is read. It
+        is up to the caller to track the overall max value.
+        """
+        temp = self._maxOutstandingRequests
+        self._maxOutstandingRequests = self._outstandingRequests
+        return temp
 
+
+
 class LimitingInheritingProtocolFactory(InheritingProtocolFactory):
     """
     An L{InheritingProtocolFactory} that supports the implicit factory contract
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151214/c9a4f435/attachment-0001.html>


More information about the calendarserver-changes mailing list