コード例 #1
0
ファイル: bench_pingpong.py プロジェクト: mitake/ix-bench
def bench_ix(args, host1, host2):
    bench_common.deploy(host1,
                        [args.ix + '/dp/ix', args.ix + '/apps/echoserver'])
    bench_common.deploy(host2,
                        [args.ix + '/dp/ix', args.ix + '/apps/echoclient'])
    for msg_size in IX_MSG_SIZES:
        result = 0
        try:
            with bench_common.ProcessManager() as proc_manager:
                channel, pid = proc_manager.spawn(
                    host1,
                    'sudo stdbuf -o0 -e0 %(DIR)s/ix -c /etc/ix.conf -- %(DIR)s/echoserver %(msg_size)d 2'
                    % {
                        'DIR': DIR,
                        'msg_size': msg_size
                    }, 'sudo kill {pid}')
                time.sleep(IX_WAIT_TO_BOOT_SECS)
                bench_common.consume(channel)
                clients = bench_common.Clients(
                    proc_manager, [host2],
                    'sudo %(DIR)s/ix -l 0 -c /etc/ix.conf -- %(DIR)s/echoclient %(host)s %(port)d %(msg_size)d'
                    % {
                        'DIR': DIR,
                        'host': bench_common.get_host_ip(host1),
                        'port': IX_PORT,
                        'msg_size': msg_size
                    }, 'sudo kill {pid}')
                result = clients.run()
        finally:
            print '%d %f' % (msg_size, result)
コード例 #2
0
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument('--target', choices=['linux', 'ix'], required=True)
  parser.add_argument('--ix')
  parser.add_argument('server')
  parser.add_argument('client', nargs='+')
  args = parser.parse_args()

  server = spur.SshShell(args.server, missing_host_key = spur.ssh.MissingHostKey.accept)
  clients = []
  for client_name in args.client:
    clients.append(spur.SshShell(client_name, missing_host_key = spur.ssh.MissingHostKey.accept))

  cores = bench_common.get_cores(server)

  if args.target == 'linux':
    server_deploy = ['server']
  elif args.target == 'ix':
    server_deploy = [args.ix + '/dp/ix', args.ix + '/apps/echoserver', args.ix + '/cp/ixcp.py']
  bench_common.deploy(server, server_deploy)
  for client in clients:
    bench_common.deploy(client, ['client'])

  for core_count in xrange(1, len(cores) + 1):
    bench(args.target, server, clients, cores, core_count, DEF_MSG_SIZE, 1)

  for msg_per_conn in MSGS_PER_CONN:
    bench(args.target, server, clients, cores, len(cores), DEF_MSG_SIZE, msg_per_conn)

  for msg_size in MSG_SIZES:
    bench(args.target, server, clients, cores, len(cores), msg_size, 1)
コード例 #3
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--target', choices=['linux', 'ix'], required=True)
    parser.add_argument('--ix')
    parser.add_argument('--kstats', action='store_true')
    parser.add_argument('server')
    parser.add_argument('client', nargs='+')
    args = parser.parse_args()

    server = spur.SshShell(args.server,
                           missing_host_key=spur.ssh.MissingHostKey.accept)
    clients = []
    for client_name in args.client:
        clients.append(
            spur.SshShell(client_name,
                          missing_host_key=spur.ssh.MissingHostKey.accept))

    if args.target == 'linux':
        server_deploy = ['server']
    elif args.target == 'ix':
        server_deploy = [args.ix + '/dp/ix', args.ix + '/apps/echoserver']
    bench_common.deploy(server, server_deploy)
    for client in clients:
        bench_common.deploy(client, ['client'])

    cores = bench_common.get_cores(server)

    with bench_common.ProcessManager() as proc_manager:
        if args.target == 'linux':
            port = LINUX_PORT
            core_str = ','.join([str(x) for x in cores])
            proc_manager.spawn(
                server, '/tmp/' + getpass.getuser() + '/server %d %s' %
                (DEF_MSG_SIZE, core_str), 'kill {pid}')
        elif args.target == 'ix':
            port = IX_PORT
            channel, pid = proc_manager.spawn(
                server,
                'sudo stdbuf -o0 -e0 /tmp/' + getpass.getuser() +
                '/ix -c /etc/ix.conf -- /tmp/' + getpass.getuser() +
                '/echoserver %d 524288' % DEF_MSG_SIZE,
                'sudo kill {pid}',
                ignore_stdout=True)
            bench_common.wait_for_network(clients[0],
                                          bench_common.get_host_ip(server),
                                          port)
            bench_common.consume(channel)

        i = 1.4
        while i <= 5.5:
            connections_per_client = int(10**i) / len(clients)
            bench(server, clients, connections_per_client, port, len(cores),
                  channel if args.kstats else None)
            i += 0.2
コード例 #4
0
ファイル: bench_pingpong.py プロジェクト: ix-project/ix-bench
def bench_linux(args, host1, host2):
  bench_common.deploy(host1, ['NPtcp'])
  bench_common.deploy(host2, ['NPtcp'])
  with bench_common.ProcessManager() as proc_manager:
    proc_manager.spawn(host1, 'stdbuf -o0 -e0 %(DIR)s/NPtcp -r -n 100 -p 0 -l 64 -u 1048576' % {'DIR' : DIR}, 'kill {pid}')
    host2.run(shlex.split('rm -f %(DIR)s/np.out' % {'DIR' : DIR}))
    host2.run(shlex.split('%(DIR)s/NPtcp -r -n 100 -p 0 -l 64 -u 1048576 -h %(host)s' % {'DIR' : DIR, 'host': bench_common.get_host_ip(host1)}), cwd = DIR)
    cmd = host2.run(shlex.split('cat %(DIR)s/np.out' % {'DIR' : DIR}))
    for pkt_size, goodput_mbps, _ in [[float(field) for field in line.split()] for line in cmd.output.splitlines()]:
      msg_per_sec = goodput_mbps * 1024 * 1024 / 8 / 2 / pkt_size
      print '%d %f' % (pkt_size, msg_per_sec)
コード例 #5
0
ファイル: bench_memcached.py プロジェクト: mitake/ix-bench
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument('--target', choices=['linux', 'ix'], required=True)
  parser.add_argument('--workload', choices=WORKLOADS.keys(), required=True)
  parser.add_argument('--mutilate', required=True)
  parser.add_argument('--memcached', required=True)
  parser.add_argument('--batch')
  parser.add_argument('--ix')
  parser.add_argument('server')
  parser.add_argument('client', nargs='+')
  args = parser.parse_args()

  server = spur.SshShell(args.server, missing_host_key = spur.ssh.MissingHostKey.accept)
  clients = []
  for client_name in args.client:
    clients.append(spur.SshShell(client_name, missing_host_key = spur.ssh.MissingHostKey.accept))

  server_deploy = [args.memcached]
  if args.target == 'ix':
    server_deploy.extend([args.ix + '/dp/ix', args.ix + '/cp/ixcp.py'])
  bench_common.deploy(server, server_deploy)
  for client in clients:
    bench_common.deploy(client, [args.mutilate])

  server.run(shlex.split('cp /etc/ix.conf '+DIR+'/ix.conf'))
  if args.batch is not None:
    server.run(shlex.split("sed -i 's/^batch=.*/batch={0}/' ".format(args.batch)+DIR+"/ix.conf"))

  with bench_common.ProcessManager() as proc_manager:
    if args.target == 'linux':
      port = LINUX_PORT
      cores = bench_common.get_cores(server)
      core_count = len(cores)
      cores = ','.join(cores)
      numa_node = int(server.run(shlex.split('cat /sys/devices/system/cpu/cpu%s/topology/physical_package_id' % cores[0])).output)
      proc_manager.spawn(server, 'stdbuf -o0 -e0 numactl -m %(numa_node)d %(DIR)s/memcached -k -Mm 1024 -c 4096 -o hashpower=20 -b 8192 -t %(core_count)d -T %(cores)s' % {'DIR': DIR, 'numa_node': numa_node, 'core_count': core_count, 'cores': cores}, 'kill {pid}')
      bench_common.wait_for_network(clients[0], bench_common.get_host_ip(server), port)
    elif args.target == 'ix':
      port = IX_PORT
      channel, pid = proc_manager.spawn(server, 'sudo stdbuf -o0 -e0 %(DIR)s/ix -c %(DIR)s/ix.conf -- %(DIR)s/memcached -k -Mm 1024 -c 4096 -o hashpower=20' % {'DIR': DIR}, 'sudo kill {pid}')
      bench_common.wait_for_network(clients[0], bench_common.get_host_ip(server), port)
      bench_common.consume(channel)

    cmdline = '--server=%s:%d %s --qps-function=%s --report-stats=1 --stop-latency=50:750' % (bench_common.get_host_ip(server), port, WORKLOADS[args.workload], SCAN)
    mutilate = bench_common.mutilate_benchmark(proc_manager, clients, cmdline, CONNECTIONS, THREADS, RECORDS, DEPTH, LATENCY_CONNECTIONS, LATENCY_QPS, TIME)

    for line in mutilate:
      if line is None:
        break
      if line[0] not in '01234567890 #':
        continue
      print line[:-1]
コード例 #6
0
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument('--ix')
  parser.add_argument('--target', choices=['linux', 'ix'], required=True)
  parser.add_argument('--workload', choices=WORKLOADS.keys(), required=True)
  parser.add_argument('--with-background-job', action='store_true', dest='background')
  parser.add_argument('--mutilate', required=True)
  parser.add_argument('--memcached', required=True)
  parser.add_argument('server')
  parser.add_argument('client', nargs='+')
  args = parser.parse_args()

  server = spur.SshShell(args.server, missing_host_key = spur.ssh.MissingHostKey.accept)
  clients = []
  for client_name in args.client:
    clients.append(spur.SshShell(client_name, missing_host_key = spur.ssh.MissingHostKey.accept))

  server_deploy = [args.memcached]
  if args.target == 'ix':
    server_deploy.extend([args.ix + '/dp/ix', args.ix + '/cp/ixcp.py'])
  if args.background:
    server_deploy.append('sha1_bench')
  bench_common.deploy(server, server_deploy)
  for client in clients:
    bench_common.deploy(client, [args.mutilate])

  frequencies = server.run(shlex.split('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies')).output
  frequencies = sorted(map(int, frequencies.split()), reverse = True)

  cores = bench_common.get_cores(server)
  numa_node = int(server.run(shlex.split('cat /sys/devices/system/cpu/cpu%s/topology/physical_package_id' % cores[0])).output)

  cores_obj = Cores(server, cores)

  power = Power(server, int(cores[0]))

  if args.background:
    core_spread_list = cores_obj.spread_list()
    for freq in frequencies:
      set_freq(server, freq)
      power.start()
      sha1_thr = server.run(shlex.split('taskset -c %(cores)s %(DIR)s/sha1_bench -t 5 -T %(count)d -s 41943040' % { 'DIR': DIR, 'cores': ','.join(map(str,core_spread_list)), 'count': len(core_spread_list) })).output
      this_power = power.read()
      sha1_thr = sha1_thr.split()
      sha1_thr = sha1_thr[3]
      print 0, '00000000', freq, 0, 'read', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this_power, sha1_thr

  for corelist, htlist, backlist in cores_obj.all_cfgs(args.background):
    for freq in frequencies:
      set_freq(server, freq)
      bench(args, server, clients, numa_node, power, freq, corelist, htlist, backlist)
コード例 #7
0
ファイル: bench_pingpong.py プロジェクト: ix-project/ix-bench
def bench_ix(args, host1, host2):
  bench_common.deploy(host1, [args.ix + '/dp/ix', args.ix + '/apps/echoserver'])
  bench_common.deploy(host2, [args.ix + '/dp/ix', args.ix + '/apps/echoclient'])
  for msg_size in IX_MSG_SIZES:
    result = 0
    try:
      with bench_common.ProcessManager() as proc_manager:
        channel, pid = proc_manager.spawn(host1, 'sudo stdbuf -o0 -e0 %(DIR)s/ix -c /etc/ix.conf -- %(DIR)s/echoserver %(msg_size)d 2' % {'DIR' : DIR, 'msg_size': msg_size}, 'sudo kill {pid}')
        time.sleep(IX_WAIT_TO_BOOT_SECS)
        bench_common.consume(channel)
        clients = bench_common.Clients(proc_manager, [host2], 'sudo %(DIR)s/ix -l 0 -c /etc/ix.conf -- %(DIR)s/echoclient %(host)s %(port)d %(msg_size)d' % {'DIR' : DIR, 'host': bench_common.get_host_ip(host1), 'port': IX_PORT, 'msg_size': msg_size}, 'sudo kill {pid}')
        result = clients.run()
    finally:
      print '%d %f' % (msg_size, result)
コード例 #8
0
ファイル: bench_pingpong.py プロジェクト: mitake/ix-bench
def bench_linux(args, host1, host2):
    bench_common.deploy(host1, ['NPtcp'])
    bench_common.deploy(host2, ['NPtcp'])
    with bench_common.ProcessManager() as proc_manager:
        proc_manager.spawn(
            host1,
            'stdbuf -o0 -e0 %(DIR)s/NPtcp -r -n 100 -p 0 -l 64 -u 1048576' %
            {'DIR': DIR}, 'kill {pid}')
        host2.run(shlex.split('rm -f %(DIR)s/np.out' % {'DIR': DIR}))
        host2.run(shlex.split(
            '%(DIR)s/NPtcp -r -n 100 -p 0 -l 64 -u 1048576 -h %(host)s' % {
                'DIR': DIR,
                'host': bench_common.get_host_ip(host1)
            }),
                  cwd=DIR)
        cmd = host2.run(shlex.split('cat %(DIR)s/np.out' % {'DIR': DIR}))
        for pkt_size, goodput_mbps, _ in [[
                float(field) for field in line.split()
        ] for line in cmd.output.splitlines()]:
            msg_per_sec = goodput_mbps * 1024 * 1024 / 8 / 2 / pkt_size
            print '%d %f' % (pkt_size, msg_per_sec)
コード例 #9
0
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument('--target', choices=['linux', 'ix'], required=True)
  parser.add_argument('--ix')
  parser.add_argument('--kstats', action='store_true')
  parser.add_argument('server')
  parser.add_argument('client', nargs='+')
  args = parser.parse_args()

  server = spur.SshShell(args.server, missing_host_key = spur.ssh.MissingHostKey.accept)
  clients = []
  for client_name in args.client:
    clients.append(spur.SshShell(client_name, missing_host_key = spur.ssh.MissingHostKey.accept))

  if args.target == 'linux':
    server_deploy = ['server']
  elif args.target == 'ix':
    server_deploy = [args.ix + '/dp/ix', args.ix + '/apps/echoserver']
  bench_common.deploy(server, server_deploy)
  for client in clients:
    bench_common.deploy(client, ['client'])

  cores = bench_common.get_cores(server)

  with bench_common.ProcessManager() as proc_manager:
    if args.target == 'linux':
      port = LINUX_PORT
      core_str = ','.join([str(x) for x in cores])
      proc_manager.spawn(server, '/tmp/'+getpass.getuser()+'/server %d %s' % (DEF_MSG_SIZE, core_str), 'kill {pid}')
    elif args.target == 'ix':
      port = IX_PORT
      channel, pid = proc_manager.spawn(server, 'sudo stdbuf -o0 -e0 /tmp/'+getpass.getuser()+'/ix -c /etc/ix.conf -- /tmp/'+getpass.getuser()+'/echoserver %d 524288' % DEF_MSG_SIZE, 'sudo kill {pid}', ignore_stdout = True)
      bench_common.wait_for_network(clients[0], bench_common.get_host_ip(server), port)
      bench_common.consume(channel)

    i = 1.4
    while i <= 5.5:
      connections_per_client = int(10**i) / len(clients)
      bench(server, clients, connections_per_client, port, len(cores), channel if args.kstats else None)
      i += 0.2
コード例 #10
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--ix', required=True)
    parser.add_argument('--workload', choices=WORKLOADS.keys(), required=True)
    parser.add_argument('--pattern', choices=PATTERNS.keys(), required=True)
    parser.add_argument('--with-background-job',
                        action='store_true',
                        dest='background')
    parser.add_argument('--mutilate', required=True)
    parser.add_argument('--memcached', required=True)
    parser.add_argument('--outdir', required=True)
    parser.add_argument('server')
    parser.add_argument('client', nargs='+')
    args = parser.parse_args()

    if not os.path.exists(args.outdir):
        os.makedirs(args.outdir)

    server = spur.SshShell(args.server,
                           missing_host_key=spur.ssh.MissingHostKey.accept)
    clients = []
    for client_name in args.client:
        clients.append(
            spur.SshShell(client_name,
                          missing_host_key=spur.ssh.MissingHostKey.accept))

    server_deploy = [
        args.ix + '/dp/ix', args.ix + '/cp/ixcp.py', args.memcached
    ]
    if args.background:
        server_deploy.append('sha1_bench')
    bench_common.deploy(server, server_deploy)
    for client in clients:
        bench_common.deploy(client, [args.mutilate])

    with bench_common.ProcessManager() as proc_manager:
        channel, pid = proc_manager.spawn(
            server,
            'sudo stdbuf -o0 -e0  %(DIR)s/ix -c /etc/ix.conf --  %(DIR)s/memcached -k -Mm 1024 -c 4096 -o hashpower=20'
            % {'DIR': DIR}, 'sudo kill {pid}')
        bench_common.wait_for_network(clients[0],
                                      bench_common.get_host_ip(server),
                                      IX_PORT)
        bench_common.consume(channel)

        if args.background:
            server.run(
                shlex.split('rm -f  %(DIR)s/sha1_bench.control' %
                            {'DIR': DIR}))
            server.run(
                shlex.split('mkfifo  %(DIR)s/sha1_bench.control' %
                            {'DIR': DIR}))
            proc, background_pid = proc_manager.spawn(
                server,
                'stdbuf -o0 -e0 %(DIR)s/sha1_bench -T 0 -s 41943040 -c  %(DIR)s/sha1_bench.control'
                % {'DIR': DIR}, 'kill {pid}')
            proc.settimeout(1)
            sha1_bench = proc.makefile('rb')
            server.run(shlex.split('sudo chrt -rap 99 %d' % background_pid))

        server.run(
            shlex.split('sudo sh -c "rm -f  %(DIR)s/block-*.fifo"' %
                        {'DIR': DIR}))
        server.run(shlex.split('sudo  %(DIR)s/ixcp.py --cpus 1' %
                               {'DIR': DIR}),
                   cwd=DIR)

        if args.background:
            cores = bench_common.get_cores(server)
            cores = cores[:len(cores) / 2]
            cores.reverse()
            cores = ','.join(cores)
            proc, _ = proc_manager.spawn(
                server,
                'sudo stdbuf -o0 -e0  %(DIR)s/ixcp.py --control back --background-cpus %(cores)s --background-fifo %(DIR)s/sha1_bench.control --background-pid %(background_pid)d'
                % {
                    'DIR': DIR,
                    'cores': cores,
                    'background_pid': background_pid
                },
                'sudo kill {pid}',
                cwd=DIR)
            proc.settimeout(1)
            ixcp = proc.makefile('rb')
            server.run(shlex.split('kill -USR1 %d' % (background_pid, )))
        else:
            proc, _ = proc_manager.spawn(
                server,
                'sudo stdbuf -o0 -e0  %(DIR)s/ixcp.py --control eff' %
                {'DIR': DIR},
                'sudo kill {pid}',
                cwd=DIR)
            proc.settimeout(1)
            ixcp = proc.makefile('rb')

        cmdline = ' --server=%s:%d %s --report-stats=1 %s --qps-warmup=%d' % (
            bench_common.get_host_ip(server), IX_PORT,
            WORKLOADS[args.workload], PATTERNS[args.pattern], WARMUP)
        mutilate = bench_common.mutilate_benchmark(proc_manager, clients,
                                                   cmdline, CONNECTIONS,
                                                   THREADS, RECORDS, DEPTH,
                                                   LATENCY_CONNECTIONS,
                                                   LATENCY_QPS, TIME)
        ixcp = bench_common.generator_from_file(ixcp)

        mutilate_file = open(args.outdir + '/mutilate.out', 'w')
        ixcp_file = open(args.outdir + '/ixcp.out', 'w')
        for src, line in bench_common.multiplexer(mutilate, ixcp):
            if src == 0:
                if line is None:
                    break
                print >> mutilate_file, line[:-1],
                print >> mutilate_file, server.run(
                    shlex.split('sudo  %(DIR)s/ixcp.py --print-power' %
                                {'DIR': DIR})).output[:-1],
                if args.background:
                    server.run(
                        shlex.split('kill -USR1 %d' % (background_pid, )))
                    line = bench_common.readline_retry(sha1_bench)[:-1]
                    parts = line.split()
                    print >> mutilate_file, parts[3]
                else:
                    print >> mutilate_file, ''
            elif src == 1:
                print >> ixcp_file, line[:-1]
コード例 #11
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--ix')
    parser.add_argument('--target', choices=['linux', 'ix'], required=True)
    parser.add_argument('--workload', choices=WORKLOADS.keys(), required=True)
    parser.add_argument('--with-background-job',
                        action='store_true',
                        dest='background')
    parser.add_argument('--mutilate', required=True)
    parser.add_argument('--memcached', required=True)
    parser.add_argument('server')
    parser.add_argument('client', nargs='+')
    args = parser.parse_args()

    server = spur.SshShell(args.server,
                           missing_host_key=spur.ssh.MissingHostKey.accept)
    clients = []
    for client_name in args.client:
        clients.append(
            spur.SshShell(client_name,
                          missing_host_key=spur.ssh.MissingHostKey.accept))

    server_deploy = [args.memcached]
    if args.target == 'ix':
        server_deploy.extend([args.ix + '/dp/ix', args.ix + '/cp/ixcp.py'])
    if args.background:
        server_deploy.append('sha1_bench')
    bench_common.deploy(server, server_deploy)
    for client in clients:
        bench_common.deploy(client, [args.mutilate])

    frequencies = server.run(
        shlex.split(
            'cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies'
        )).output
    frequencies = sorted(map(int, frequencies.split()), reverse=True)

    cores = bench_common.get_cores(server)
    numa_node = int(
        server.run(
            shlex.split(
                'cat /sys/devices/system/cpu/cpu%s/topology/physical_package_id'
                % cores[0])).output)

    cores_obj = Cores(server, cores)

    power = Power(server, int(cores[0]))

    if args.background:
        core_spread_list = cores_obj.spread_list()
        for freq in frequencies:
            set_freq(server, freq)
            power.start()
            sha1_thr = server.run(
                shlex.split(
                    'taskset -c %(cores)s %(DIR)s/sha1_bench -t 5 -T %(count)d -s 41943040'
                    % {
                        'DIR': DIR,
                        'cores': ','.join(map(str, core_spread_list)),
                        'count': len(core_spread_list)
                    })).output
            this_power = power.read()
            sha1_thr = sha1_thr.split()
            sha1_thr = sha1_thr[3]
            print 0, '00000000', freq, 0, 'read', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, this_power, sha1_thr

    for corelist, htlist, backlist in cores_obj.all_cfgs(args.background):
        for freq in frequencies:
            set_freq(server, freq)
            bench(args, server, clients, numa_node, power, freq, corelist,
                  htlist, backlist)
コード例 #12
0
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument('--ix', required=True)
  parser.add_argument('--workload', choices=WORKLOADS.keys(), required=True)
  parser.add_argument('--pattern', choices=PATTERNS.keys(), required=True)
  parser.add_argument('--with-background-job', action='store_true', dest='background')
  parser.add_argument('--mutilate', required=True)
  parser.add_argument('--memcached', required=True)
  parser.add_argument('--outdir', required=True)
  parser.add_argument('server')
  parser.add_argument('client', nargs='+')
  args = parser.parse_args()

  if not os.path.exists(args.outdir):
    os.makedirs(args.outdir)

  server = spur.SshShell(args.server, missing_host_key = spur.ssh.MissingHostKey.accept)
  clients = []
  for client_name in args.client:
    clients.append(spur.SshShell(client_name, missing_host_key = spur.ssh.MissingHostKey.accept))

  server_deploy = [args.ix + '/dp/ix', args.ix + '/cp/ixcp.py', args.memcached]
  if args.background:
    server_deploy.append('sha1_bench')
  bench_common.deploy(server, server_deploy)
  for client in clients:
    bench_common.deploy(client, [args.mutilate])

  with bench_common.ProcessManager() as proc_manager:
    channel, pid = proc_manager.spawn(server, 'sudo stdbuf -o0 -e0  %(DIR)s/ix -c /etc/ix.conf --  %(DIR)s/memcached -k -Mm 1024 -c 4096 -o hashpower=20' % {'DIR' : DIR}, 'sudo kill {pid}')
    bench_common.wait_for_network(clients[0], bench_common.get_host_ip(server), IX_PORT)
    bench_common.consume(channel)

    if args.background:
      server.run(shlex.split('rm -f  %(DIR)s/sha1_bench.control' % {'DIR' : DIR}))
      server.run(shlex.split('mkfifo  %(DIR)s/sha1_bench.control' % {'DIR' : DIR}))
      proc, background_pid = proc_manager.spawn(server, 'stdbuf -o0 -e0 %(DIR)s/sha1_bench -T 0 -s 41943040 -c  %(DIR)s/sha1_bench.control' % {'DIR' : DIR}, 'kill {pid}')
      proc.settimeout(1)
      sha1_bench = proc.makefile('rb')
      server.run(shlex.split('sudo chrt -rap 99 %d' % background_pid))

    server.run(shlex.split('sudo sh -c "rm -f  %(DIR)s/block-*.fifo"' % {'DIR' : DIR}))
    server.run(shlex.split('sudo  %(DIR)s/ixcp.py --cpus 1' % {'DIR' : DIR}), cwd = DIR)

    if args.background:
      cores = bench_common.get_cores(server)
      cores = cores[:len(cores)/2]
      cores.reverse()
      cores = ','.join(cores)
      proc, _ = proc_manager.spawn(server, 'sudo stdbuf -o0 -e0  %(DIR)s/ixcp.py --control back --background-cpus %(cores)s --background-fifo %(DIR)s/sha1_bench.control --background-pid %(background_pid)d' % {'DIR' : DIR, 'cores': cores, 'background_pid': background_pid}, 'sudo kill {pid}', cwd = DIR)
      proc.settimeout(1)
      ixcp = proc.makefile('rb')
      server.run(shlex.split('kill -USR1 %d' % (background_pid,)))
    else:
      proc, _ = proc_manager.spawn(server, 'sudo stdbuf -o0 -e0  %(DIR)s/ixcp.py --control eff' % {'DIR' : DIR}, 'sudo kill {pid}', cwd = DIR)
      proc.settimeout(1)
      ixcp = proc.makefile('rb')

    cmdline = ' --server=%s:%d %s --report-stats=1 %s --qps-warmup=%d' % (bench_common.get_host_ip(server), IX_PORT, WORKLOADS[args.workload], PATTERNS[args.pattern], WARMUP)
    mutilate = bench_common.mutilate_benchmark(proc_manager, clients, cmdline, CONNECTIONS, THREADS, RECORDS, DEPTH, LATENCY_CONNECTIONS, LATENCY_QPS, TIME)
    ixcp = bench_common.generator_from_file(ixcp)

    mutilate_file = open(args.outdir + '/mutilate.out', 'w')
    ixcp_file = open(args.outdir + '/ixcp.out', 'w')
    for src, line in bench_common.multiplexer(mutilate, ixcp):
      if src == 0:
        if line is None:
          break
        print >>mutilate_file, line[:-1],
        print >>mutilate_file, server.run(shlex.split('sudo  %(DIR)s/ixcp.py --print-power' % {'DIR' : DIR})).output[:-1],
        if args.background:
          server.run(shlex.split('kill -USR1 %d' % (background_pid,)))
          line = bench_common.readline_retry(sha1_bench)[:-1]
          parts = line.split()
          print >>mutilate_file, parts[3]
        else:
          print >>mutilate_file, ''
      elif src == 1:
        print >>ixcp_file, line[:-1]