示例#1
0
def start_ycsb_clients(clusters, **kwargs):
    def fmt_ycsb_string(runType, cluster):
        return (('cd /home/ubuntu/kaiju/contrib/YCSB;' +
                 netCmd+
                 'rm *.log;' \
                     'bin/ycsb %s kaiju -p hosts=%s -threads %d -p txnlen=%d -p readproportion=%s -p updateproportion=%s -p fieldlength=%d -p histogram.buckets=%d -p fieldcount=1 -p operationcount=100000000 -p recordcount=%d -p isolation_level=%s -p read_atomic_algorithm=%s -t -s ' \
                     ' -p requestdistribution=%s -p maxexecutiontime=%d -P %s' \
                     ' 1>%s_out.log 2>%s_err.log') % (runType,
                                                      KAIJU_HOSTS_EXTERNAL,
                                                      kwargs.get("threads", 10) if runType != 'load' else min(1000, kwargs.get("recordcount")/10),
                                                      kwargs.get("txnlen", 8),
                                                      kwargs.get("readprop", .5),
                                                      1-kwargs.get("readprop", .5),
                                                      kwargs.get("valuesize", 1),
                                                      kwargs.get("numbuckets", 10000),
                                                      kwargs.get("recordcount", 10000),
                                                      kwargs.get("isolation_level", "READ_COMMITTED"),
                                                      kwargs.get("ra_algorithm", "KEY_LIST"),
                                                      kwargs.get("keydistribution", "zipfian"),
                                                      kwargs.get("time", 60) if runType != 'load' else 10000,
                                                      kwargs.get("workload", "workloads/workloada"),
                                                      runType,
                                                      runType))

    cluster = clusters[0]
    pprint("Loading YCSB on single client: %s." % (cluster.clients[0].ip))
    run_cmd_single(cluster.clients[0].ip,
                   fmt_ycsb_string("load", cluster),
                   time=kwargs.get("recordcount", 180))
    pprint("Done")
    sleep(10)

    pprint("Running YCSB on all clients.")
    if kwargs.get("bgrun", False):
        for client in cluster.clients:
            start_cmd_disown(client.ip, fmt_ycsb_string("run", cluster))

        sleep(kwargs.get("time") + 15)
    else:
        run_cmd("all-clients",
                fmt_ycsb_string("run", cluster),
                time=kwargs.get("time", 60) + 30)
    pprint("Done")
def start_ycsb_clients(clusters, **kwargs):
    def fmt_ycsb_string(runType, cluster):
        return (('cd /home/ubuntu/kaiju/contrib/YCSB;' +
                 netCmd+
                 'rm *.log;' \
                     'bin/ycsb %s kaiju -p hosts=%s -threads %d -p txnlen=%d -p readproportion=%s -p updateproportion=%s -p fieldlength=%d -p histogram.buckets=%d -p fieldcount=1 -p operationcount=100000000 -p recordcount=%d -p isolation_level=%s -p read_atomic_algorithm=%s -t -s ' \
                     ' -p requestdistribution=%s -p maxexecutiontime=%d -P %s' \
                     ' 1>%s_out.log 2>%s_err.log') % (runType,
                                                      KAIJU_HOSTS_EXTERNAL,
                                                      kwargs.get("threads", 10) if runType != 'load' else min(1000, kwargs.get("recordcount")/10),
                                                      kwargs.get("txnlen", 8),
                                                      kwargs.get("readprop", .5),
                                                      1-kwargs.get("readprop", .5),
                                                      kwargs.get("valuesize", 1),
                                                      kwargs.get("numbuckets", 10000),
                                                      kwargs.get("recordcount", 10000),
                                                      kwargs.get("isolation_level", "READ_COMMITTED"),
                                                      kwargs.get("ra_algorithm", "KEY_LIST"),
                                                      kwargs.get("keydistribution", "zipfian"),
                                                      kwargs.get("time", 60) if runType != 'load' else 10000,
                                                      kwargs.get("workload", "workloads/workloada"),
                                                      runType,
                                                      runType))
    
    cluster = clusters[0]
    pprint("Loading YCSB on single client: %s." % (cluster.clients[0].ip))
    run_cmd_single(cluster.clients[0].ip, fmt_ycsb_string("load", cluster), time=kwargs.get("recordcount", 180))
    pprint("Done")
    sleep(10)

    pprint("Running YCSB on all clients.")
    if kwargs.get("bgrun", False):
        for client in cluster.clients:
            start_cmd_disown(client.ip, fmt_ycsb_string("run", cluster))

        sleep(kwargs.get("time")+15)
    else:
        run_cmd("all-clients", fmt_ycsb_string("run", cluster), time=kwargs.get("time", 60)+30)
    pprint("Done")