def Prepare(bm_spec: _BenchmarkSpec) -> None:
    """Install Redis on K8s cluster and memtier_benchmark on client VMs."""
    redis_cluster_size = FLAGS.kubernetes_redis_cluster_size
    # We configure the Redis cluster with one replica per master. Ensure that the
    # redis cluster size is even to account for this topology.
    if redis_cluster_size % 2 != 0:
        raise errors.Benchmarks.PrepareException(
            f'Expected redis cluster size to be even, got {redis_cluster_size}'
        )

    # TODO(user): Add support for multiple Nodepools, to separate out the nodes
    # used for Redis from the Nodes used for Memtier. This will eliminate the
    # need for these checks and allow Memtier machine types to be different than
    # Redis machine types.
    client_vms = bm_spec.vm_groups['clients']
    min_num_nodes = (redis_cluster_size / 2) + len(client_vms)
    k8s_cluster_size = bm_spec.container_cluster.num_nodes
    if k8s_cluster_size < min_num_nodes:
        raise errors.Benchmarks.PrepareException(
            f'Container cluster size must be at least {min_num_nodes}, got '
            f'{k8s_cluster_size}')

    # Install Memtier and Redis on the cluster
    prepare_fns = (
        [functools.partial(_PrepareCluster, bm_spec)] +
        [functools.partial(vm.Install, 'memtier') for vm in client_vms])

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

    # Load Redis database
    memtier.Load(client_vms[0], bm_spec.redis_endpoint_ip,
                 str(redis_server.GetRedisPorts()[0]))
def Prepare(benchmark_spec):
    """Prepare the virtual machines to run memtier against memcached.

  Args:
    benchmark_spec: The benchmark specification. Contains all data that is
        required to run the benchmark.
  """
    client = benchmark_spec.vm_groups['client'][0]
    server = benchmark_spec.vm_groups['server'][0]

    _InstallMemtier(client)
    _InstallMemcached(server)
    memcached_server.ConfigureAndStart(server)
    memtier.Load(client, server.internal_ip, memcached_server.MEMCACHED_PORT)
Пример #3
0
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))
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)
Пример #5
0
def Prepare(benchmark_spec):
    """Prepare the cloud redis instance for memtier tasks.

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

    memtier_vms = benchmark_spec.vm_groups['clients']
    vm_util.RunThreaded(_Install, memtier_vms)

    benchmark_spec.cloud_redis_instance = _GetManagedMemoryStore(
        benchmark_spec)
    benchmark_spec.cloud_redis_instance.Create()
    memory_store_ip = benchmark_spec.cloud_redis_instance.GetMemoryStoreIp()
    memory_store_port = benchmark_spec.cloud_redis_instance.GetMemoryStorePort(
    )
    password = benchmark_spec.cloud_redis_instance.GetMemoryStorePassword()

    for vm in memtier_vms:
        memtier.Load(vm, memory_store_ip, memory_store_port, password)