Example #1
0
def measure(calendar, organizerSequence, events, host, port, dtrace, samples):
    """
    Benchmark event creation.
    """
    user = password = "******" % (organizerSequence,)
    root = "/"
    principal = "/"

    authinfo = HTTPDigestAuthHandler()
    authinfo.add_password(
        realm="Test Realm",
        uri="http://%s:%d/" % (host, port),
        user=user,
        passwd=password)
    agent = AuthHandlerAgent(Agent(reactor), authinfo)

    # First set things up
    yield initialize(agent, host, port, user, password, root, principal, calendar)

    method = 'PUT'
    uri = 'http://%s:%d/calendars/__uids__/%s/%s/foo-%%d.ics' % (
        host, port, user, calendar)
    headers = Headers({"content-type": ["text/calendar"]})

    # Sample it a bunch of times
    samples = yield sample(
        dtrace, samples,
        agent, ((method, uri % (i,), headers, StringProducer(body))
                for (i, body)
                in events).next,
        CREATED)
    returnValue(samples)
Example #2
0
def measure(host, port, dtrace, attendeeCount, samples):
    user = password = "******"
    root = "/"
    principal = "/"
    calendar = "event-creation-benchmark"

    authinfo = HTTPDigestAuthHandler()
    authinfo.add_password(
        realm="Test Realm",
        uri="http://%s:%d/" % (host, port),
        user=user,
        passwd=password)
    agent = AuthHandlerAgent(Agent(reactor), authinfo)

    # First set things up
    yield initialize(agent, host, port, user, password, root, principal, calendar)

    method = 'PUT'
    uri = 'http://%s:%d/calendars/__uids__/%s/%s/foo-%%d.ics' % (
        host, port, user, calendar)
    headers = Headers({"content-type": ["text/calendar"]})

    # An infinite stream of VEVENTs to PUT to the server.
    events = ((i, makeEvent(i, attendeeCount)) for i in count(2))

    # Sample it a bunch of times
    samples = yield sample(
        dtrace, samples, 
        agent, ((method, uri % (i,), headers, StringProducer(body))
                for (i, body)
                in events).next)
    returnValue(samples)
def measure(host, port, dtrace, events, samples):
    user = password = "******"
    root = "/"
    principal = "/"
    calendar = "vfreebusy-benchmark"

    authinfo = HTTPDigestAuthHandler()
    authinfo.add_password(
        realm="Test Realm",
        uri="http://%s:%d/" % (host, port),
        user=user,
        passwd=password)
    agent = AuthHandlerAgent(Agent(reactor), authinfo)

    # First set things up
    account = yield initialize(
        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)):
        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"]})
    body = StringProducer(vfreebusy)

    samples = yield sample(
        dtrace, samples,
        agent, lambda: (method, uri, headers, body))
    returnValue(samples)
Example #4
0
def measure(calendar, organizerSequence, events, host, port, dtrace, samples):
    """
    Benchmark event creation.
    """
    user = password = "******" % (organizerSequence,)
    root = "/"
    principal = "/"

    authinfo = HTTPDigestAuthHandler()
    authinfo.add_password(
        realm="Test Realm",
        uri="http://%s:%d/" % (host, port),
        user=user,
        passwd=password)
    agent = AuthHandlerAgent(Agent(reactor), authinfo)

    # First set things up
    yield initialize(agent, host, port, user, password, root, principal, calendar)

    method = 'PUT'
    uri = 'http://%s:%d/calendars/__uids__/%s/%s/foo-%%d.ics' % (
        host, port, user, calendar)
    headers = Headers({"content-type": ["text/calendar"]})

    # Sample it a bunch of times
    samples = yield sample(
        dtrace, samples,
        agent, ((method, uri % (i,), headers, StringProducer(body))
                for (i, body)
                in events).next,
        CREATED)
    returnValue(samples)
Example #5
0
def _generous_sample(dtrace, replacer, agent, host, port, user, calendar,
                     fieldName, attendeeCount, samples):
    url = 'http://%s:%s/calendars/__uids__/%s/%s/%s-change.ics' % (
        host, port, user, calendar, fieldName)

    headers = Headers({"content-type": ["text/calendar"]})

    # See the makeEvent call above.
    event = makeEvent(0, 1, attendeeCount)

    yield agent.request('PUT', url, headers, StringProducer(event))

    # Sample changing the event according to the replacer.
    samples = yield sample(dtrace, samples, agent,
                           (('PUT', url, headers,
                             StringProducer(replacer(event, i)))
                            for i in count(1)).next, NO_CONTENT)
    returnValue(samples)
Example #6
0
def _generous_sample(dtrace, replacer, agent, host, port, user, calendar, fieldName, attendeeCount, samples):
    url = 'http://%s:%s/calendars/__uids__/%s/%s/%s-change.ics' % (
        host, port, user, calendar, fieldName)

    headers = Headers({"content-type": ["text/calendar"]})

    # See the makeEvent call above.
    event = makeEvent(0, 1, attendeeCount)

    yield agent.request('PUT', url, headers, StringProducer(event))

    # Sample changing the event according to the replacer.
    samples = yield sample(
        dtrace, samples,
        agent, (('PUT', url, headers, StringProducer(replacer(event, i)))
                for i in count(1)).next,
        NO_CONTENT)
    returnValue(samples)
Example #7
0
def _selfish_sample(dtrace, replacer, agent, host, port, user, calendar,
                    fieldName, attendeeCount, samples):
    url = 'http://%s:%s/calendars/__uids__/%s/%s/%s-change-%%d.ics' % (
        host, port, user, calendar, fieldName)

    headers = Headers({"content-type": ["text/calendar"]})

    events = [
        # The organizerSequence here (1) may need to be a parameter.
        # See also the makeEvent call below.
        (makeEvent(i, 1, attendeeCount), url % (i, )) for i in range(samples)
    ]

    for (event, url) in events:
        yield agent.request('PUT', url, headers, StringProducer(event))

    # Sample changing the event according to the replacer.
    samples = yield sample(dtrace, samples, agent,
                           (('PUT', url, headers,
                             StringProducer(replacer(event, i)))
                            for i, (event, url) in enumerate(events)).next,
                           NO_CONTENT)
    returnValue(samples)
Example #8
0
def _selfish_sample(dtrace, replacer, agent, host, port, user, calendar, fieldName, attendeeCount, samples):
    url = 'http://%s:%s/calendars/__uids__/%s/%s/%s-change-%%d.ics' % (
        host, port, user, calendar, fieldName)

    headers = Headers({"content-type": ["text/calendar"]})

    events = [
        # The organizerSequence here (1) may need to be a parameter.
        # See also the makeEvent call below.
        (makeEvent(i, 1, attendeeCount), url % (i,))
        for i in range(samples)]

    for (event, url) in events:
        yield agent.request('PUT', url, headers, StringProducer(event))

    # Sample changing the event according to the replacer.
    samples = yield sample(
        dtrace, samples,
        agent, (('PUT', url, headers, StringProducer(replacer(event, i)))
                for i, (event, url)
                in enumerate(events)).next,
        NO_CONTENT)
    returnValue(samples)
Example #9
0
def measure(host, port, dtrace, attendeeCount, samples):
    user = password = "******"
    root = "/"
    principal = "/"
    calendar = "report-principal"

    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)

    url = 'http://%s:%d/principals/' % (host, port)
    headers = Headers({"content-type": ["text/xml"]})

    samples = yield sample(
        dtrace, samples, agent, lambda:
        ('REPORT', url, headers, StringProducer(body)))
    returnValue(samples)
def measure(host, port, dtrace, attendeeCount, samples):
    user = password = "******"
    root = "/"
    principal = "/"
    calendar = "report-principal"

    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)

    url = 'http://%s:%d/principals/' % (host, port)
    headers = Headers({"content-type": ["text/xml"]})

    samples = yield sample(
        dtrace, samples, agent,
        lambda: ('REPORT', url, headers, StringProducer(body)))
    returnValue(samples)