[CalendarServer-changes] [7777] CalendarServer/trunk/contrib/performance/benchmarks
source_changes at macosforge.org
source_changes at macosforge.org
Tue Jul 12 12:18:02 PDT 2011
Revision: 7777
http://trac.macosforge.org/projects/calendarserver/changeset/7777
Author: exarkun at twistedmatrix.com
Date: 2011-07-12 12:18:02 -0700 (Tue, 12 Jul 2011)
Log Message:
-----------
Issue a contemporaneous VFREEBUSY query in both the VFREEBUSY benchmarks; also put in some http headers which iCal issues but the benchmark didn't previously.
Modified Paths:
--------------
CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy.py
CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy_vary_attendees.py
Modified: CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy.py
===================================================================
--- CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy.py 2011-07-12 17:16:09 UTC (rev 7776)
+++ CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy.py 2011-07-12 19:18:02 UTC (rev 7777)
@@ -68,8 +68,8 @@
PRODID:-//Apple Inc.//iCal 4.0.3//EN
BEGIN:VFREEBUSY
UID:81F582C8-4E7F-491C-85F4-E541864BE0FA
-DTEND:20100730T150000Z
-%(attendees)sDTSTART:20100730T140000Z
+DTEND:%(end)s
+%(attendees)sDTSTART:%(start)s
X-CALENDARSERVER-MASK-UID:EC75A61B-08A3-44FD-BFBB-2457BBD0D490
DTSTAMP:20100729T174751Z
ORGANIZER:mailto:user01 at example.com
@@ -81,7 +81,13 @@
def formatDate(d):
return ''.join(filter(str.isalnum, d.isoformat()))
+
def makeEvent(i):
+ # Backwards compat interface, don't delete it for a little while.
+ return makeEventNear(datetime(2010, 7, 30, 11, 15, 00), i)
+
+
+def makeEventNear(base, i):
s = """\
BEGIN:VEVENT
UID:%(UID)s
@@ -94,7 +100,6 @@
TRANSP:OPAQUE
END:VEVENT
"""
- base = datetime(2010, 7, 30, 11, 15, 00)
interval = timedelta(hours=2)
duration = timedelta(hours=1)
return event % {
@@ -107,8 +112,8 @@
}
-def makeEvents(n):
- return [makeEvent(i) for i in range(n)]
+def makeEvents(base, n):
+ return [makeEventNear(base, i) for i in range(n)]
@inlineCallbacks
@@ -131,14 +136,23 @@
agent, host, port, user, password, root, principal, calendar)
base = "/calendars/users/%s/%s/foo-%%d.ics" % (user, calendar)
- for i, cal in enumerate(makeEvents(events)):
+ baseTime = datetime.now().replace(minute=15, second=0, microsecond=0)
+ for i, cal in enumerate(makeEvents(baseTime, events)):
yield account.writeData(base % (i,), cal, "text/calendar")
method = 'POST'
uri = 'http://%s:%d/calendars/__uids__/%s/outbox/' % (host, port, user)
- headers = Headers({"content-type": ["text/calendar"]})
+ headers = Headers({
+ "content-type": ["text/calendar"],
+ "originator": ["mailto:%s at example.com" % (user,)],
+ "recipient": ["urn:uuid:%s, urn:uuid:user02" % (user,)]})
body = StringProducer(VFREEBUSY % {
- "attendees": "ATTENDEE:urn:uuid:user02\n"})
+ "attendees": "".join([
+ "ATTENDEE:urn:uuid:%s\n" % (user,),
+ "ATTENDEE:urn:uuid:user02\n"]),
+ "start": formatDate(baseTime.replace(hour=0, minute=0)) + 'Z',
+ "end": formatDate(
+ baseTime.replace(hour=0, minute=0) + timedelta(days=1)) + 'Z'})
samples = yield sample(
dtrace, samples,
Modified: CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy_vary_attendees.py
===================================================================
--- CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy_vary_attendees.py 2011-07-12 17:16:09 UTC (rev 7776)
+++ CalendarServer/trunk/contrib/performance/benchmarks/vfreebusy_vary_attendees.py 2011-07-12 19:18:02 UTC (rev 7777)
@@ -19,6 +19,7 @@
attendees in the request.
"""
+from datetime import datetime, timedelta
from urllib2 import HTTPDigestAuthHandler
from twisted.internet.defer import inlineCallbacks, returnValue
@@ -31,11 +32,12 @@
from httpclient import StringProducer
from benchlib import CalDAVAccount, sample
-from benchmarks.vfreebusy import VFREEBUSY, makeEvent
+from benchmarks.vfreebusy import VFREEBUSY, formatDate, makeEventNear
@inlineCallbacks
def measure(host, port, dtrace, attendees, samples):
- user = password = "user01"
+ userNumber = 1
+ user = password = "user%02d" % (userNumber,)
root = "/"
principal = "/"
calendar = "vfreebusy-vary-attendees-benchmark"
@@ -46,7 +48,7 @@
# 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:
+ for i in [userNumber] + targets:
targetUser = "user%02d" % (i,)
for path in ["calendars/users/%s/" % (targetUser,),
"calendars/__uids__/%s/" % (targetUser,)]:
@@ -58,6 +60,7 @@
agent = AuthHandlerAgent(Agent(reactor), authinfo)
# Set up events on about half of the target accounts
+ baseTime = datetime.now().replace(minute=45, second=0, microsecond=0)
for i in targets[::2]:
targetUser = "user%02d" % (i,)
account = CalDAVAccount(
@@ -68,19 +71,26 @@
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")
+ yield account.writeData(cal + "foo.ics", makeEventNear(baseTime, 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"]})
+ headers = Headers({
+ "content-type": ["text/calendar"],
+ "originator": ["mailto:%s at example.com" % (user,)],
+ "recipient": [", ".join(["urn:uuid:user%02d" % (i,) for i in [userNumber] + targets])]})
body = StringProducer(VFREEBUSY % {
"attendees": "".join([
"ATTENDEE:urn:uuid:user%02d\n" % (i,)
- for i in targets])})
+ for i in [userNumber] + targets]),
+ "start": formatDate(baseTime.replace(hour=0, minute=0)) + 'Z',
+ "end": formatDate(
+ baseTime.replace(hour=0, minute=0) + timedelta(days=1)) + 'Z'})
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/20110712/ed945e1e/attachment-0001.html>
More information about the calendarserver-changes
mailing list