Esempio n. 1
0
def SetupRoot(root_vm, leaf_vms):
    """Connect a root node to a list of leaf nodes.

  Args:
    root_vm: A root vm instance.
    leaf_vms: A list of leaf vm instances.
  """
    fanout_args = ' '.join(['--leaf=%s' % i.internal_ip for i in leaf_vms])
    root_server_bin = oldisim_dependencies.BinaryPath('ParentNode')
    root_cmd = '%s --threads=%s %s' % (
        root_server_bin, root_vm.NumCpusForBenchmark(), fanout_args)
    logging.info('Root cmdline: %s', root_cmd)
    root_vm.RemoteCommand('%s &> /dev/null &' % root_cmd)
Esempio n. 2
0
def RunLoadTest(benchmark_spec, fanout):
  """Run Loadtest for a given topology.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.
    fanout: Request is first processed by a root node, which then
        fans out to a subset of leaf nodes.

  Returns:
    A tuple of (peak_qps, peak_lat, target_qps, target_lat).
  """
  assert fanout <= FLAGS.oldisim_num_leaves, (
      'The number of leaf nodes a root node connected to is defined by the '
      'flag fanout. Its current value %s is bigger than the total number of '
      'leaves %s.' % (fanout, FLAGS.oldisim_num_leaves))

  vms = benchmark_spec.vms
  driver_vms = []
  root_vms = []
  leaf_vms = []

  for vm_index, vm in enumerate(vms):
    if vm_index < NUM_DRIVERS:
      driver_vms.append(vm)
    elif vm_index < (NUM_DRIVERS + NUM_ROOTS):
      root_vms.append(vm)
    else:
      leaf_vms.append(vm)
  leaf_vms = leaf_vms[:fanout]

  for root_vm in root_vms:
    SetupRoot(root_vm, leaf_vms)

  driver_vm = driver_vms[0]
  driver_binary = oldisim_dependencies.BinaryPath('DriverNode')
  launch_script = oldisim_dependencies.Path('workloads/search/search_qps.sh')
  driver_args = ' '.join(['--server=%s' % i.internal_ip
                          for i in root_vms])
  # Make sure server is up.
  time.sleep(5)
  driver_cmd = '%s -s %s:%s -t 30 -- %s %s --threads=%s --depth=16' % (
      launch_script, FLAGS.oldisim_latency_metric, FLAGS.oldisim_latency_target,
      driver_binary, driver_args, driver_vm.num_cpus)
  logging.info('Driver cmdline: %s', driver_cmd)
  stdout, _ = driver_vm.RemoteCommand(driver_cmd, should_log=True)
  return ParseOutput(stdout)
Esempio n. 3
0
def Prepare(benchmark_spec):
  """Install and build oldisim on the target vm.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.
  """
  vms = benchmark_spec.vms

  leaf_vms = [vm for vm_idx, vm in enumerate(vms)
              if vm_idx >= (NUM_DRIVERS + NUM_ROOTS)]

  if vms:
    vm_util.RunThreaded(InstallAndBuild, vms)

  # Launch job on the leaf nodes.
  leaf_server_bin = oldisim_dependencies.BinaryPath('LeafNode')
  for vm in leaf_vms:
    leaf_cmd = '%s --threads=%s' % (leaf_server_bin, vm.num_cpus)
    vm.RemoteCommand('%s &> /dev/null &' % leaf_cmd)