[CalendarServer-changes] [7755] CalendarServer/trunk/contrib/performance

source_changes at macosforge.org source_changes at macosforge.org
Mon Jul 11 11:35:35 PDT 2011


Revision: 7755
          http://trac.macosforge.org/projects/calendarserver/changeset/7755
Author:   exarkun at twistedmatrix.com
Date:     2011-07-11 11:35:33 -0700 (Mon, 11 Jul 2011)
Log Message:
-----------
Add a VFREEBUSY microbenchmark variation which parameterizes the number of attendees of the VFREEBUSY request

Modified Paths:
--------------
    CalendarServer/trunk/contrib/performance/benchlib.sh
    CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy.py

Added Paths:
-----------
    CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy_vary_attendees.py

Modified: CalendarServer/trunk/contrib/performance/benchlib.sh
===================================================================
--- CalendarServer/trunk/contrib/performance/benchlib.sh	2011-07-11 15:37:34 UTC (rev 7754)
+++ CalendarServer/trunk/contrib/performance/benchlib.sh	2011-07-11 18:35:33 UTC (rev 7755)
@@ -28,13 +28,15 @@
 # The plist the server will respect.
 CONF=$SOURCE/conf/caldavd-dev.plist
 
-# Names of benchmarks we can run.
-BENCHMARKS="find_calendars find_events event_move event_delete_attendee event_add_attendee event_change_date event_change_summary event_delete vfreebusy event bounded_recurrence unbounded_recurrence event_autoaccept bounded_recurrence_autoaccept unbounded_recurrence_autoaccept"
+# Names of benchmarks we can run.  Since ordering makes a difference to how
+# benchmarks are split across multiple hosts, new benchmarks should be appended
+# to this list, not inserted earlier on.
+BENCHMARKS="find_calendars find_events event_move event_delete_attendee event_add_attendee event_change_date event_change_summary event_delete vfreebusy event bounded_recurrence unbounded_recurrence event_autoaccept bounded_recurrence_autoaccept unbounded_recurrence_autoaccept vfreebusy_vary_attendees"
 
 # Custom scaling parameters for benchmarks that merit it.  Be careful
 # not to exceed the 99 user limit for benchmarks where the scaling
 # parameter represents a number of users!
-SCALE_PARAMETERS="--parameters find_events:1,10,100,1000,10000"
+SCALE_PARAMETERS="--parameters find_events:1,10,100,1000,10000 --parameters vfreebusy_vary_attendees:1,9,30"
 
 # Names of metrics we can collect.
 STATISTICS=(HTTP SQL read write pagein pageout)

Modified: CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy.py
===================================================================
--- CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy.py	2011-07-11 15:37:34 UTC (rev 7754)
+++ CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy.py	2011-07-11 18:35:33 UTC (rev 7755)
@@ -15,7 +15,8 @@
 ##
 
 """
-Benchmark a server's handling of VFREEBUSY requests.
+Benchmark a server's handling of VFREEBUSY requests with a varying number of
+events on the target's calendar.
 """
 
 from urllib2 import HTTPDigestAuthHandler
@@ -59,7 +60,7 @@
 END:VCALENDAR
 """
 
-vfreebusy = """\
+VFREEBUSY = """\
 BEGIN:VCALENDAR
 CALSCALE:GREGORIAN
 VERSION:2.0
@@ -68,8 +69,7 @@
 BEGIN:VFREEBUSY
 UID:81F582C8-4E7F-491C-85F4-E541864BE0FA
 DTEND:20100730T150000Z
-ATTENDEE:urn:uuid:user02
-DTSTART:20100730T140000Z
+%(attendees)sDTSTART:20100730T140000Z
 X-CALENDARSERVER-MASK-UID:EC75A61B-08A3-44FD-BFBB-2457BBD0D490
 DTSTAMP:20100729T174751Z
 ORGANIZER:mailto:user01 at example.com
@@ -137,7 +137,8 @@
     method = 'POST'
     uri = 'http://%s:%d/calendars/__uids__/%s/outbox/' % (host, port, user)
     headers = Headers({"content-type": ["text/calendar"]})
-    body = StringProducer(vfreebusy)
+    body = StringProducer(VFREEBUSY % {
+            "attendees": "ATTENDEE:urn:uuid:user02\n"})
 
     samples = yield sample(
         dtrace, samples,

Added: CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy_vary_attendees.py
===================================================================
--- CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy_vary_attendees.py	                        (rev 0)
+++ CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy_vary_attendees.py	2011-07-11 18:35:33 UTC (rev 7755)
@@ -0,0 +1,86 @@
+##
+# Copyright (c) 2011 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+Benchmark a server's handling of VFREEBUSY requests with a varying number of
+attendees in the request.
+"""
+
+from urllib2 import HTTPDigestAuthHandler
+
+from twisted.internet.defer import inlineCallbacks, returnValue
+from twisted.web.http import OK
+from twisted.web.http_headers import Headers
+from twisted.web.client import Agent
+from twisted.internet import reactor
+
+from httpauth import AuthHandlerAgent
+from httpclient import StringProducer
+from benchlib import CalDAVAccount, sample
+
+from benchmarks.vfreebusy import VFREEBUSY, makeEvent
+
+ at inlineCallbacks
+def measure(host, port, dtrace, attendees, samples):
+    user = password = "user01"
+    root = "/"
+    principal = "/"
+    calendar = "vfreebusy-vary-attendees-benchmark"
+
+    targets = range(2, attendees + 2)
+
+    authinfo = HTTPDigestAuthHandler()
+
+    # Set up authentication info for our own user and all the other users that
+    # may need an event created on one of their calendars.
+    for i in [1] + targets:
+        targetUser = "user%02d" % (i,)
+        for path in ["calendars/users/%s/" % (targetUser,),
+                     "calendars/__uids__/%s/" % (targetUser,)]:
+            authinfo.add_password(
+                realm="Test Realm",
+                uri="http://%s:%d/%s" % (host, port, path),
+                user=targetUser, passwd=targetUser)
+
+    agent = AuthHandlerAgent(Agent(reactor), authinfo)
+
+    # Set up events on about half of the target accounts
+    for i in targets[::2]:
+        targetUser = "user%02d" % (i,)
+        account = CalDAVAccount(
+            agent,
+            "%s:%d" % (host, port),
+            user=targetUser, password=password,
+            root=root, principal=principal)
+        cal = "/calendars/users/%s/%s/" % (targetUser, calendar)
+        yield account.deleteResource(cal)
+        yield account.makeCalendar(cal)
+        yield account.writeData(cal + "foo.ics", makeEvent(i), "text/calendar")
+
+    # And now issue the actual VFREEBUSY request
+    method = 'POST'
+    uri = 'http://%s:%d/calendars/__uids__/%s/outbox/' % (host, port, user)
+    headers = Headers({"content-type": ["text/calendar"]})
+    body = StringProducer(VFREEBUSY % {
+            "attendees": "".join([
+                    "ATTENDEE:urn:uuid:user%02d\n" % (i,)
+                    for i in targets])})
+
+    samples = yield sample(
+        dtrace, samples,
+        agent, lambda: (method, uri, headers, body),
+        OK)
+    returnValue(samples)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110711/0339dbad/attachment-0001.html>


More information about the calendarserver-changes mailing list