def __init__(self, i): self.key_generator = stress.SeedKeyGenerator((i, num_clients), keysize=keys) self.model = stress.ConsecutiveSeedModel() self.connection = stress.Connection( options.servers[i % len(options.servers)]) self.client = stress.Client() self.large_rget_op = stress.PercentageRangeReadOp( self.connection, percentage=(30, 100), limit=large_rget_size) self.client.add_op(large_rget_freq, self.large_rget_op)
def __init__(self, i): self.key_generator = stress.SeedKeyGenerator((i, num_clients), keysize=keys) self.model = stress.ConsecutiveSeedModel() self.connection = stress.Connection( options.servers[i % len(options.servers)]) self.client = stress.Client() self.insert_op = stress.InsertOp(self.key_generator, self.model.insert_chooser(), self.model, self.connection, values) self.client.add_op(insert_freq, self.insert_op) # TODO: Does this specific workload make sense? self.small_rget_op = stress.PercentageRangeReadOp( self.connection, percentage=(1, 2), limit=small_rget_size) self.client.add_op(small_rget_freq, self.small_rget_op) self.large_rget_op = stress.PercentageRangeReadOp( self.connection, percentage=(30, 100), limit=large_rget_size) self.client.add_op(large_rget_freq, self.large_rget_op)
def __init__(self, i): self.key_generator = stress.SeedKeyGenerator((i, num_clients), keysize=keys) self.model = stress.ConsecutiveSeedModel() self.connection = stress.Connection( options.servers[i % len(options.servers)]) self.client = stress.Client() self.insert_op = stress.InsertOp(self.key_generator, self.model.insert_chooser(), self.model, self.connection, values) self.client.add_op(insert_freq, self.insert_op) self.update_op = stress.UpdateOp(self.key_generator, self.model.live_chooser(), self.model, self.connection, values) self.client.add_op(update_freq, self.update_op) self.delete_op = stress.DeleteOp(self.key_generator, self.model.delete_chooser(), self.model, self.connection) self.client.add_op(delete_freq, self.delete_op) self.read_op = stress.ReadOp(self.key_generator, self.model.live_chooser(), self.connection, (1, 16)) self.client.add_op(read_freq, self.read_op)
# Copyright 2010-2012 RethinkDB, all rights reserved. #!/usr/bin/env python # Copyright 2010-2012 RethinkDB, all rights reserved. import stress, os, time client = stress.Client() conn = stress.Connection("localhost:%d" % int(os.environ["RUN_PORT"])) key_generator = stress.SeedKeyGenerator() model = stress.ConsecutiveSeedModel() read_op = stress.ReadOpGenerator(1, key_generator, model.live_chooser(), conn) client.add_op(1, read_op) insert_op = stress.InsertOpGenerator(1, key_generator, model.insert_chooser(), model, conn) client.add_op(1, insert_op) def avg(x): if len(x) == 0: return "N/A" else: return sum(x) / len(x) client.start() for i in xrange(10): time.sleep(1) read_op.lock() insert_op.lock() read_lats = read_op.poll()["latency_samples"] insert_lats = insert_op.poll()["latency_samples"] print i, avg(insert_lats), avg(read_lats) read_op.reset() insert_op.reset()