Exemple #1
0
def Prepare(benchmark_spec):
    """Install Redis on one VM and memtier_benchmark on another.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.
  """
    groups = benchmark_spec.vm_groups
    redis_vm = groups['workers'][0]
    ycsb_vms = groups['clients']

    prepare_fns = ([functools.partial(PrepareServer, redis_vm)] +
                   [functools.partial(vm.Install, 'ycsb') for vm in ycsb_vms])

    vm_util.RunThreaded(lambda f: f(), prepare_fns)

    num_ycsb = FLAGS.redis_ycsb_processes
    num_server = FLAGS.redis_total_num_processes
    # Each redis process use different ports, number of ycsb processes should
    # be at least as large as number of server processes, use round-robin
    # to assign target server process to each ycsb process
    server_metadata = [{
        'redis.port':
        redis_server.REDIS_FIRST_PORT + i % num_server
    } for i in range(num_ycsb)]

    benchmark_spec.executor = ycsb.YCSBExecutor(
        'redis', **{
            'shardkeyspace': True,
            'redis.host': redis_vm.internal_ip,
            'perclientparam': server_metadata
        })
    vm_util.SetupSimulatedMaintenance(redis_vm)
def Prepare(bm_spec: _BenchmarkSpec) -> None:
    """Install Redis on one VM and memtier_benchmark on another."""
    server_count = len(bm_spec.vm_groups['servers'])
    if server_count != 1:
        raise errors.Benchmarks.PrepareException(
            f'Expected servers vm count to be 1, got {server_count}')
    client_vms = bm_spec.vm_groups['clients']
    server_vm = bm_spec.vm_groups['servers'][0]

    # Install memtier
    vm_util.RunThreaded(lambda client: client.Install('memtier'),
                        client_vms + [server_vm])

    if redis_server.REDIS_SIMULATE_AOF.value:
        server_vm.RemoteCommand(
            'yes | sudo mdadm --create /dev/md1 --level=stripe --force --raid-devices=1 /dev/nvme0n8'
        )
        server_vm.RemoteCommand('sudo mkfs.ext4 -F /dev/md1')
        server_vm.RemoteCommand(
            f'sudo mkdir -p /{redis_server.REDIS_BACKUP}; '
            f'sudo mount -o discard /dev/md1 /{redis_server.REDIS_BACKUP} && '
            f'sudo chown $USER:$USER /{redis_server.REDIS_BACKUP};')

        server_vm.InstallPackages('fio')
        for disk in server_vm.scratch_disks:
            cmd = (
                'sudo fio --name=global --direct=1 --ioengine=libaio --numjobs=1 '
                '--refill_buffers --scramble_buffers=1 --allow_mounted_write=1 '
                '--blocksize=128k --rw=write --iodepth=64 --size=100% '
                f'--name=wipc --filename={disk.device_path}')
            logging.info('Start filling %s. This may take up to 30min...',
                         disk.device_path)
            server_vm.RemoteCommand(cmd)

    # Install redis on the 1st machine.
    server_vm.Install('redis_server')
    redis_server.Start(server_vm)

    # Load the redis server with preexisting data.
    for port in redis_server.GetRedisPorts():
        memtier.Load(server_vm, 'localhost', str(port))

    bm_spec.redis_endpoint_ip = bm_spec.vm_groups['servers'][0].internal_ip
    vm_util.SetupSimulatedMaintenance(server_vm)
def Prepare(bm_spec: _BenchmarkSpec) -> None:
    """Install Redis on one VM and memtier_benchmark on another."""
    server_count = len(bm_spec.vm_groups['servers'])
    if server_count != 1:
        raise errors.Benchmarks.PrepareException(
            f'Expected servers vm count to be 1, got {server_count}')
    client_vms = bm_spec.vm_groups['clients']
    server_vm = bm_spec.vm_groups['servers'][0]

    # Install memtier
    vm_util.RunThreaded(lambda client: client.Install('memtier'),
                        client_vms + [server_vm])

    # Install redis on the 1st machine.
    server_vm.Install('redis_server')
    redis_server.Start(server_vm)
    memtier.Load(server_vm, 'localhost', str(redis_server.DEFAULT_PORT))

    bm_spec.redis_endpoint_ip = bm_spec.vm_groups['servers'][0].internal_ip
    vm_util.SetupSimulatedMaintenance(server_vm)