Example #1
0
    data = open(__file__).read()

    print "Benchmarking multiget:"
    print "      CPUs: {0}".format(cpu_count())
    print "   Threads: {0}".format(POOL_SIZE)
    print "      Keys: {0}".format(len(bkeys))
    print

    with benchmark.measure() as b:
        with b.report('populate'):
            for bucket, key in bkeys:
                client.bucket(bucket).new(key, encoded_data=data,
                                          content_type='text/plain'
                                          ).store()
    for b in benchmark.measure_with_rehearsal():
        client.protocol = 'http'
        with b.report('http seq'):
            for bucket, key in bkeys:
                client.bucket(bucket).get(key)

        with b.report('http multi'):
            multiget(client, bkeys)

        client.protocol = 'pbc'
        with b.report('pbc seq'):
            for bucket, key in bkeys:
                client.bucket(bucket).get(key)

        with b.report('pbc multi'):
            multiget(client, bkeys)
Example #2
0
bkeys = [('default', 'multiget', str(key)) for key in range(10000)]

data = binascii.b2a_hex(os.urandom(1024))

print("Benchmarking multiget:")
print("      CPUs: {0}".format(cpu_count()))
print("   Threads: {0}".format(client._multiget_pool._size))
print("      Keys: {0}".format(len(bkeys)))
print()

with benchmark.measure() as b:
    with b.report('populate'):
        for _, bucket, key in bkeys:
            client.bucket(bucket).new(key, encoded_data=data,
                                      content_type='text/plain'
                                      ).store()
for b in benchmark.measure_with_rehearsal():
    # client.protocol = 'http'
    # with b.report('http seq'):
    #     for _, bucket, key in bkeys:
    #         client.bucket(bucket).get(key)
    # with b.report('http multi'):
    #     client.multiget(bkeys)

    client.protocol = 'pbc'
    with b.report('pbc seq'):
        for _, bucket, key in bkeys:
            client.bucket(bucket).get(key)
    with b.report('pbc multi'):
        client.multiget(bkeys)
Example #3
0
    data = open(__file__).read()

    print "Benchmarking multiget:"
    print "      CPUs: {0}".format(cpu_count())
    print "   Threads: {0}".format(POOL_SIZE)
    print "      Keys: {0}".format(len(bkeys))
    print

    with benchmark.measure() as b:
        with b.report('populate'):
            for bucket, key in bkeys:
                client.bucket(bucket).new(key, encoded_data=data,
                                          content_type='text/plain'
                                          ).store()
    for b in benchmark.measure_with_rehearsal():
        client.protocol = 'http'
        with b.report('http seq'):
            for bucket, key in bkeys:
                client.bucket(bucket).get(key)

        with b.report('http multi'):
            multiget(client, bkeys)

        client.protocol = 'pbc'
        with b.report('pbc seq'):
            for bucket, key in bkeys:
                client.bucket(bucket).get(key)

        with b.report('pbc multi'):
            multiget(client, bkeys)
Example #4
0
bkeys = [('default', 'multiget', str(key)) for key in range(10000)]

data = binascii.b2a_hex(os.urandom(1024))

print("Benchmarking multiget:")
print("      CPUs: {0}".format(cpu_count()))
print("   Threads: {0}".format(client._multiget_pool._size))
print("      Keys: {0}".format(len(bkeys)))
print()

with benchmark.measure() as b:
    with b.report('populate'):
        for _, bucket, key in bkeys:
            client.bucket(bucket).new(key, encoded_data=data,
                                      content_type='text/plain'
                                      ).store()
for b in benchmark.measure_with_rehearsal():
    # client.protocol = 'http'
    # with b.report('http seq'):
    #     for _, bucket, key in bkeys:
    #         client.bucket(bucket).get(key)
    # with b.report('http multi'):
    #     client.multiget(bkeys)

    client.protocol = 'pbc'
    with b.report('pbc seq'):
        for _, bucket, key in bkeys:
            client.bucket(bucket).get(key)
    with b.report('pbc multi'):
        client.multiget(bkeys)