def measure(host, port, dtrace, attendeeCount, samples): organizerSequence = 1 user = password = "******" % (organizerSequence,) root = "/" principal = "/" # Two calendars between which to move the event. fooCalendar = "event-move-foo-benchmark" barCalendar = "event-move-bar-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 calendars first for calendar in [fooCalendar, barCalendar]: yield initialize(agent, host, port, user, password, root, principal, calendar) fooURI = "http://%s:%d/calendars/__uids__/%s/%s/some-event.ics" % (host, port, user, fooCalendar) barURI = "http://%s:%d/calendars/__uids__/%s/%s/some-event.ics" % (host, port, user, barCalendar) # Create the event that will move around headers = Headers({"content-type": ["text/calendar"]}) yield agent.request("PUT", fooURI, headers, StringProducer(makeEvent(1, organizerSequence, attendeeCount))) # Move it around sooo much source = cycle([fooURI, barURI]) dest = cycle([barURI, fooURI]) params = (("MOVE", source.next(), Headers({"destination": [dest.next()], "overwrite": ["F"]})) for i in count(1)) samples = yield sample(dtrace, samples, agent, params.next, CREATED) returnValue(samples)
def worker(): for i in range(numEvents): event = makeEvent(i, 1, 0) yield agent.request( 'PUT', '%s%s%d.ics' % (uri, cal, i), Headers({"content-type": ["text/calendar"]}), StringProducer(event))
def worker(): for i in range(numEvents): event = makeEvent(i, 1, 0) yield agent.request( 'PUT', '%s%s%d.ics' % (uri, cal, i), Headers({"content-type": ["text/calendar"]}), StringProducer(event))
def measure(host, port, dtrace, attendeeCount, samples): organizerSequence = 1 user = password = "******" % (organizerSequence, ) root = "/" principal = "/" # Two calendars between which to move the event. fooCalendar = "event-move-foo-benchmark" barCalendar = "event-move-bar-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 calendars first for calendar in [fooCalendar, barCalendar]: yield initialize(agent, host, port, user, password, root, principal, calendar) fooURI = 'http://%s:%d/calendars/__uids__/%s/%s/some-event.ics' % ( host, port, user, fooCalendar) barURI = 'http://%s:%d/calendars/__uids__/%s/%s/some-event.ics' % ( host, port, user, barCalendar) # Create the event that will move around headers = Headers({"content-type": ["text/calendar"]}) yield agent.request( 'PUT', fooURI, headers, StringProducer(makeEvent(1, organizerSequence, attendeeCount))) # Move it around sooo much source = cycle([fooURI, barURI]) dest = cycle([barURI, fooURI]) params = (('MOVE', source.next(), Headers({ "destination": [dest.next()], "overwrite": ["F"] })) for i in count(1)) samples = yield sample(dtrace, samples, agent, params.next, CREATED) returnValue(samples)
def measure(host, port, dtrace, attendeeCount, samples): organizerSequence = 1 user = password = "******" % (organizerSequence,) root = "/" principal = "/" calendar = "event-deletion-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) # An infinite stream of VEVENTs to PUT to the server. events = ((i, makeEvent(i, organizerSequence, attendeeCount)) for i in count(2)) # Create enough events to delete uri = 'http://%s:%d/calendars/__uids__/%s/%s/foo-%%d.ics' % ( host, port, user, calendar) headers = Headers({"content-type": ["text/calendar"]}) urls = [] for i, body in events: urls.append(uri % (i,)) yield agent.request( 'PUT', urls[-1], headers, StringProducer(body)) if len(urls) == samples: break # Now delete them all samples = yield sample( dtrace, samples, agent, (('DELETE', url) for url in urls).next, NO_CONTENT) returnValue(samples)
def measure(host, port, dtrace, attendeeCount, samples): organizerSequence = 1 user = password = "******" % (organizerSequence,) root = "/" principal = "/" calendar = "event-deletion-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) # An infinite stream of VEVENTs to PUT to the server. events = ((i, makeEvent(i, organizerSequence, attendeeCount)) for i in count(2)) # Create enough events to delete uri = 'http://%s:%d/calendars/__uids__/%s/%s/foo-%%d.ics' % ( host, port, user, calendar) headers = Headers({"content-type": ["text/calendar"]}) urls = [] for i, body in events: urls.append(uri % (i,)) yield agent.request( 'PUT', urls[-1], headers, StringProducer(body)) if len(urls) == samples: break # Now delete them all samples = yield sample( dtrace, samples, agent, (('DELETE', url) for url in urls).next, NO_CONTENT) returnValue(samples)