[CalendarServer-changes] [13788] CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/ performance/sqlusage

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 24 09:02:02 PDT 2014


Revision: 13788
          http://trac.calendarserver.org//changeset/13788
Author:   cdaboo at apple.com
Date:     2014-07-24 09:02:02 -0700 (Thu, 24 Jul 2014)
Log Message:
-----------
SYnc up sqlusage changes from trunk.

Modified Paths:
--------------
    CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/httpTests.py
    CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/invite.py
    CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/multiget.py
    CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/propfind.py
    CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/propfind_invite.py
    CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/query.py
    CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/sync.py
    CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/sqlusage.py

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/httpTests.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/httpTests.py	2014-07-24 15:57:13 UTC (rev 13787)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/httpTests.py	2014-07-24 16:02:02 UTC (rev 13788)
@@ -31,7 +31,7 @@
             self.timing = timing
 
 
-    def __init__(self, label, sessions, logFilePath):
+    def __init__(self, label, sessions, logFilePath, logFilePrefix):
         """
         @param label: label used to identify the test
         @type label: C{str}
@@ -39,6 +39,7 @@
         self.label = label
         self.sessions = sessions
         self.logFilePath = logFilePath
+        self.logFilePrefix = logFilePrefix
         self.result = None
 
 
@@ -95,7 +96,7 @@
         offset = 0
         while True:
             if lines[offset] == "*** SQL Stats ***":
-                if lines[offset + 2].split()[1] != "unlabeled":
+                if lines[offset + 2].startswith("Label: <"):
                     count = extractInt(lines[offset + 4])
                     rows = extractInt(lines[offset + 5])
                     timing = extractFloat(lines[offset + 6])
@@ -105,7 +106,8 @@
         else:
             self.result = HTTPTestBase.SQLResults(-1, -1, 0.0)
 
-        with open("%s-%d-%s" % (self.logFilePath, event_count, self.label), "w") as f:
+        # Archive current sqlstats file
+        with open("%s-%s-%d-%s" % (self.logFilePath, self.logFilePrefix, event_count, self.label), "w") as f:
             f.write(data)
 
 

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/invite.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/invite.py	2014-07-24 15:57:13 UTC (rev 13787)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/invite.py	2014-07-24 16:02:02 UTC (rev 13788)
@@ -45,22 +45,29 @@
 BEGIN:VEVENT
 DTSTAMP:20051222T205953Z
 CREATED:20060101T150000Z
-DTSTART;TZID=US/Eastern:%d0101T100000
+DTSTART;TZID=US/Eastern:{year}0101T100000
 DURATION:PT1H
-SUMMARY:event 1
-UID:invite-ics
+SUMMARY:event {count}
+UID:invite-{count}-ics
 ORGANIZER:mailto:user02 at example.com
 ATTENDEE:mailto:user02 at example.com
-ATTENDEE:mailto:user01 at example.com
+{attendees}
 END:VEVENT
 END:VCALENDAR
 """.replace("\n", "\r\n")
 
+ATTENDEE = "ATTENDEE:mailto:user%02d at example.com"
+
 class InviteTest(HTTPTestBase):
     """
     A PUT operation (invite)
     """
 
+    def __init__(self, label, sessions, logFilePath, logFilePrefix, count):
+        super(InviteTest, self).__init__(label, sessions, logFilePath, logFilePrefix)
+        self.count = count
+
+
     def doRequest(self):
         """
         Execute the actual HTTP request.
@@ -69,7 +76,12 @@
         # Invite as user02
         now = PyCalendarDateTime.getNowUTC()
         href = joinURL(self.sessions[1].calendarHref, "organizer.ics")
-        self.sessions[1].writeData(URL(path=href), ICAL % (now.getYear() + 1,), "text/calendar")
+        attendees = "\r\n".join(["ATTENDEE:mailto:user01 at example.com"] + [ATTENDEE % (ctr + 3,) for ctr in range(self.count - 1)])
+        self.sessions[1].writeData(
+            URL(path=href),
+            ICAL.format(year=now.getYear() + 1, count=self.count, attendees=attendees),
+            "text/calendar",
+        )
 
 
     def cleanup(self):
@@ -82,11 +94,12 @@
 
         # Remove the attendee event and inbox items
         props = (davxml.resourcetype,)
-        results = self.sessions[0].getPropertiesOnHierarchy(URL(path=self.sessions[0].calendarHref), props)
-        for href in results.keys():
-            if len(href.split("/")[-1]) > 10:
-                self.sessions[0].deleteResource(URL(path=href))
-        results = self.sessions[0].getPropertiesOnHierarchy(URL(path=self.sessions[0].inboxHref), props)
-        for href in results.keys():
-            if href != self.sessions[0].inboxHref:
-                self.sessions[0].deleteResource(URL(path=href))
+        for sessionid in ((0, 2, 3, 4, 5) if self.count == 5 else (0,)):
+            results = self.sessions[sessionid].getPropertiesOnHierarchy(URL(path=self.sessions[sessionid].calendarHref), props)
+            for href in results.keys():
+                if len(href.split("/")[-1]) > 10:
+                    self.sessions[sessionid].deleteResource(URL(path=href))
+            results = self.sessions[sessionid].getPropertiesOnHierarchy(URL(path=self.sessions[sessionid].inboxHref), props)
+            for href in results.keys():
+                if href != self.sessions[sessionid].inboxHref:
+                    self.sessions[sessionid].deleteResource(URL(path=href))

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/multiget.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/multiget.py	2014-07-24 15:57:13 UTC (rev 13787)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/multiget.py	2014-07-24 16:02:02 UTC (rev 13788)
@@ -26,8 +26,8 @@
     A multiget operation
     """
 
-    def __init__(self, label, sessions, logFilePath, count):
-        super(MultigetTest, self).__init__(label, sessions, logFilePath)
+    def __init__(self, label, sessions, logFilePath, logFilePrefix, count):
+        super(MultigetTest, self).__init__(label, sessions, logFilePath, logFilePrefix)
         self.count = count
 
 

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/propfind.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/propfind.py	2014-07-24 15:57:13 UTC (rev 13787)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/propfind.py	2014-07-24 16:02:02 UTC (rev 13788)
@@ -25,8 +25,8 @@
     A propfind operation
     """
 
-    def __init__(self, label, sessions, logFilePath, depth=1):
-        super(PropfindTest, self).__init__(label, sessions, logFilePath)
+    def __init__(self, label, sessions, logFilePath, logFilePrefix, depth=1):
+        super(PropfindTest, self).__init__(label, sessions, logFilePath, logFilePrefix)
         self.depth = headers.Depth1 if depth == 1 else headers.Depth0
 
 

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/propfind_invite.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/propfind_invite.py	2014-07-24 15:57:13 UTC (rev 13787)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/propfind_invite.py	2014-07-24 16:02:02 UTC (rev 13788)
@@ -26,8 +26,8 @@
     A propfind operation
     """
 
-    def __init__(self, label, sessions, logFilePath, depth=1):
-        super(PropfindInviteTest, self).__init__(label, sessions, logFilePath)
+    def __init__(self, label, sessions, logFilePath, logFilePrefix, depth=1):
+        super(PropfindInviteTest, self).__init__(label, sessions, logFilePath, logFilePrefix)
         self.depth = headers.Depth1 if depth == 1 else headers.Depth0
 
 

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/query.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/query.py	2014-07-24 15:57:13 UTC (rev 13787)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/query.py	2014-07-24 16:02:02 UTC (rev 13788)
@@ -60,8 +60,8 @@
     A sync operation
     """
 
-    def __init__(self, label, sessions, logFilePath, count):
-        super(QueryTest, self).__init__(label, sessions, logFilePath)
+    def __init__(self, label, sessions, logFilePath, logFilePrefix, count):
+        super(QueryTest, self).__init__(label, sessions, logFilePath, logFilePrefix)
         self.count = count
 
 

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/sync.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/sync.py	2014-07-24 15:57:13 UTC (rev 13787)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/requests/sync.py	2014-07-24 16:02:02 UTC (rev 13788)
@@ -58,8 +58,8 @@
     A sync operation
     """
 
-    def __init__(self, label, sessions, logFilePath, full, count):
-        super(SyncTest, self).__init__(label, sessions, logFilePath)
+    def __init__(self, label, sessions, logFilePath, logFilePrefix, full, count):
+        super(SyncTest, self).__init__(label, sessions, logFilePath, logFilePrefix)
         self.full = full
         self.count = count
         self.synctoken = ""

Modified: CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/sqlusage.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/sqlusage.py	2014-07-24 15:57:13 UTC (rev 13787)
+++ CalendarServer/branches/release/CalendarServer-5.3-dev/contrib/performance/sqlusage/sqlusage.py	2014-07-24 16:02:02 UTC (rev 13788)
@@ -115,15 +115,16 @@
 
         # Set of requests to execute
         requests = [
-            MultigetTest("mget-1" if self.compact else "multiget-1", sessions, self.logFilePath, 1),
-            MultigetTest("mget-50" if self.compact else "multiget-50", sessions, self.logFilePath, 50),
-            PropfindTest("prop-cal" if self.compact else "propfind-cal", sessions, self.logFilePath, 1),
-            SyncTest("s-full" if self.compact else "sync-full", sessions, self.logFilePath, True, 0),
-            SyncTest("s-1" if self.compact else "sync-1", sessions, self.logFilePath, False, 1),
-            QueryTest("q-1" if self.compact else "query-1", sessions, self.logFilePath, 1),
-            QueryTest("q-10" if self.compact else "query-10", sessions, self.logFilePath, 10),
-            PutTest("put", sessions, self.logFilePath),
-            InviteTest("invite", sessions, self.logFilePath),
+            MultigetTest("mget-1" if self.compact else "multiget-1", sessions, self.logFilePath, "event", 1),
+            MultigetTest("mget-50" if self.compact else "multiget-50", sessions, self.logFilePath, "event", 50),
+            PropfindTest("prop-cal" if self.compact else "propfind-cal", sessions, self.logFilePath, "event", 1),
+            SyncTest("s-full" if self.compact else "sync-full", sessions, self.logFilePath, "event", True, 0),
+            SyncTest("s-1" if self.compact else "sync-1", sessions, self.logFilePath, "event", False, 1),
+            QueryTest("q-1" if self.compact else "query-1", sessions, self.logFilePath, "event", 1),
+            QueryTest("q-10" if self.compact else "query-10", sessions, self.logFilePath, "event", 10),
+            PutTest("put", sessions, self.logFilePath, "event"),
+            InviteTest("invite-1", sessions, self.logFilePath, "event", 1),
+            InviteTest("invite-5", sessions, self.logFilePath, "event", 5),
         ]
         self.requestLabels = [request.label for request in requests]
 
@@ -221,14 +222,14 @@
 
         # Set of requests to execute
         requests = [
-            MultigetTest("mget-1" if self.compact else "multiget-1", sessions, self.logFilePath, 1),
-            MultigetTest("mget-50" if self.compact else "multiget-50", sessions, self.logFilePath, 50),
-            PropfindInviteTest("propfind", sessions, self.logFilePath, 1),
-            SyncTest("s-full" if self.compact else "sync-full", sessions, self.logFilePath, True, 0),
-            SyncTest("s-1" if self.compact else "sync-1", sessions, self.logFilePath, False, 1),
-            QueryTest("q-1" if self.compact else "query-1", sessions, self.logFilePath, 1),
-            QueryTest("q-10" if self.compact else "query-10", sessions, self.logFilePath, 10),
-            PutTest("put", sessions, self.logFilePath),
+            MultigetTest("mget-1" if self.compact else "multiget-1", sessions, self.logFilePath, "share", 1),
+            MultigetTest("mget-50" if self.compact else "multiget-50", sessions, self.logFilePath, "share", 50),
+            PropfindInviteTest("propfind", sessions, self.logFilePath, "share", 1),
+            SyncTest("s-full" if self.compact else "sync-full", sessions, self.logFilePath, "share", True, 0),
+            SyncTest("s-1" if self.compact else "sync-1", sessions, self.logFilePath, "share", False, 1),
+            QueryTest("q-1" if self.compact else "query-1", sessions, self.logFilePath, "share", 1),
+            QueryTest("q-10" if self.compact else "query-10", sessions, self.logFilePath, "share", 10),
+            PutTest("put", sessions, self.logFilePath, "share"),
         ]
         self.requestLabels = [request.label for request in requests]
 
@@ -333,8 +334,8 @@
 
     server = "localhost"
     port = 8008
-    users = ("user01", "user02",)
-    pswds = ("user01", "user02",)
+    users = ("user01", "user02", "user03", "user04", "user05", "user06",)
+    pswds = ("user01", "user02", "user03", "user04", "user05", "user06",)
     file = "sqlstats.logs"
     event_counts = EVENT_COUNTS
     sharee_counts = SHAREE_COUNTS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140724/60ad53c6/attachment-0001.html>


More information about the calendarserver-changes mailing list