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

source_changes at macosforge.org source_changes at macosforge.org
Fri Sep 10 07:48:24 PDT 2010


Revision: 6268
          http://trac.macosforge.org/projects/calendarserver/changeset/6268
Author:   exarkun at twistedmatrix.com
Date:     2010-09-10 07:48:22 -0700 (Fri, 10 Sep 2010)
Log Message:
-----------
Benchmark for changing the summary of an event with varying numbers of attendees

Modified Paths:
--------------
    CalendarServer/trunk/contrib/performance/event.py

Added Paths:
-----------
    CalendarServer/trunk/contrib/performance/event_change_summary.py

Modified: CalendarServer/trunk/contrib/performance/event.py
===================================================================
--- CalendarServer/trunk/contrib/performance/event.py	2010-09-09 22:25:03 UTC (rev 6267)
+++ CalendarServer/trunk/contrib/performance/event.py	2010-09-10 14:48:22 UTC (rev 6268)
@@ -59,6 +59,8 @@
     return ''.join(filter(str.isalnum, d.isoformat()))
 
 
+SUMMARY = "STUFF IS THINGS"
+
 def makeEvent(i, attendeeCount):
     s = """\
 BEGIN:VEVENT
@@ -70,7 +72,7 @@
 DTSTAMP:20100729T195557Z
 ORGANIZER;CN=User 03;EMAIL=user03 at example.com:urn:uuid:user03
 SEQUENCE:%(SEQUENCE)s
-SUMMARY:STUFF IS THINGS
+SUMMARY:%(summary)s
 TRANSP:OPAQUE
 END:VEVENT
 """
@@ -84,6 +86,7 @@
             'END': formatDate(base + i * interval + duration),
             'SEQUENCE': i,
             'ATTENDEES': makeAttendees(attendeeCount),
+            'summary': SUMMARY,
             },
         }
 

Added: CalendarServer/trunk/contrib/performance/event_change_summary.py
===================================================================
--- CalendarServer/trunk/contrib/performance/event_change_summary.py	                        (rev 0)
+++ CalendarServer/trunk/contrib/performance/event_change_summary.py	2010-09-10 14:48:22 UTC (rev 6268)
@@ -0,0 +1,53 @@
+
+"""
+Benchmark a server's handling of event summary changes.
+"""
+
+from itertools import count
+from urllib2 import HTTPDigestAuthHandler
+
+from twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks, returnValue
+from twisted.web.client import Agent
+from twisted.web.http_headers import Headers
+
+from httpauth import AuthHandlerAgent
+from httpclient import StringProducer
+
+from benchlib import initialize, sample
+from event import SUMMARY, makeEvent
+
+ at inlineCallbacks
+def measure(host, port, dtrace, attendeeCount, samples):
+    user = password = "user01"
+    root = "/"
+    principal = "/"
+    calendar = "event-change-summary-benchmark"
+
+    authinfo = HTTPDigestAuthHandler()
+    authinfo.add_password(
+        realm="Test Realm",
+        uri="http://%s:%d/" % (host, port),
+        user=user,
+        passwd=password)
+    agent = AuthHandlerAgent(Agent(reactor), authinfo)
+
+    # Set up the calendar first
+    yield initialize(agent, host, port, user, password, root, principal, calendar)
+
+    event = makeEvent(0, attendeeCount)
+    url = 'http://%s:%s/calendars/__uids__/%s/%s/summary-change.ics' % (
+        host, port, user, calendar)
+    headers = Headers({"content-type": ["text/calendar"]})
+
+    # Create an event to mess around with.
+    yield agent.request('PUT', url, headers, StringProducer(event))
+
+    # Change the summary to a bunch of different things
+    samples = yield sample(
+        dtrace, samples,
+        agent, (('PUT', url, headers, StringProducer(
+                    event.replace(SUMMARY, 'Replacement summary %d' % (i,))))
+                for i
+                in count()).next)
+    returnValue(samples)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100910/72590082/attachment.html>


More information about the calendarserver-changes mailing list