def Prepare(benchmark_spec): """Prepare the virtual machines to run YCSB against Cassandra. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vms = benchmark_spec.vms by_role = _GetVMsByRole(benchmark_spec) loaders = by_role['clients'] assert loaders, vms # Cassandra cluster cassandra_vms = by_role['cassandra_vms'] assert cassandra_vms, 'No Cassandra VMs: {0}'.format(by_role) seed_vm = by_role['seed_vm'] assert seed_vm, 'No seed VM: {0}'.format(by_role) cassandra_install_fns = [ functools.partial(_InstallCassandra, vm, seed_vms=[seed_vm]) for vm in cassandra_vms ] ycsb_install_fns = [ functools.partial(vm.Install, 'ycsb') for vm in loaders ] vm_util.RunThreaded(lambda f: f(), cassandra_install_fns + ycsb_install_fns) cassandra.StartCluster(seed_vm, by_role['non_seed_cassandra_vms']) _CreateYCSBTable(seed_vm)
def Prepare(benchmark_spec): """Install Cassandra and Java on target vms. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vm_dict = benchmark_spec.vm_groups cassandra_vms = vm_dict[CASSANDRA_GROUP] client_vms = vm_dict[CLIENT_GROUP] logging.info('VM dictionary %s', vm_dict) logging.info('Authorizing loader[0] permission to access all other vms.') client_vms[0].AuthenticateVm() logging.info('Preparing data files and Java on all vms.') vm_util.RunThreaded(lambda vm: vm.Install('cassandra'), cassandra_vms) vm_util.RunThreaded(lambda vm: vm.Install('cassandra_stress'), client_vms) seed_vm = cassandra_vms[0] configure = functools.partial(cassandra.Configure, seed_vms=[seed_vm]) vm_util.RunThreaded(configure, cassandra_vms) cassandra.StartCluster(seed_vm, cassandra_vms[1:]) if FLAGS.cassandra_stress_command == USER_COMMAND: for vm in client_vms: vm.PushFile(FLAGS.cassandra_stress_profile, TEMP_PROFILE_PATH) metadata = GenerateMetadataFromFlags(benchmark_spec) if metadata['num_preload_keys']: CheckMetadata(metadata) PreloadCassandraServer(benchmark_spec, metadata)
def Prepare(benchmark_spec): """Prepare the virtual machines to run YCSB against Cassandra. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ vms = benchmark_spec.vms by_role = _GetVMsByRole(benchmark_spec) loaders = by_role['clients'] assert loaders, vms # Cassandra cluster cassandra_vms = by_role['cassandra_vms'] assert cassandra_vms, 'No Cassandra VMs: {0}'.format(by_role) seed_vm = by_role['seed_vm'] assert seed_vm, 'No seed VM: {0}'.format(by_role) cassandra_install_fns = [ functools.partial(_InstallCassandra, vm, seed_vms=[seed_vm]) for vm in cassandra_vms ] ycsb_install_fns = [ functools.partial(vm.Install, 'ycsb') for vm in loaders ] if FLAGS.ycsb_client_vms: vm_util.RunThreaded(lambda f: f(), cassandra_install_fns + ycsb_install_fns) else: # If putting server and client on same vm, prepare packages one by one to # avoid race condition. vm_util.RunThreaded(lambda f: f(), cassandra_install_fns) vm_util.RunThreaded(lambda f: f(), ycsb_install_fns) cassandra.StartCluster(seed_vm, by_role['non_seed_cassandra_vms']) _CreateYCSBTable(seed_vm, replication_factor=FLAGS.cassandra_replication_factor) benchmark_spec.executor = ycsb.YCSBExecutor( 'cassandra2-cql', hosts=','.join(vm.internal_ip for vm in cassandra_vms))