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. """ vms = benchmark_spec.vms redis_vm = vms[0] # Install latest redis on the 1st machine. redis_vm.Install('redis_server') redis_server.Configure(redis_vm) redis_server.Start(redis_vm) # Remove snapshotting sed_cmd = ( r"sed -i -e '/save 900/d' -e '/save 300/d' -e '/save 60/d' -e 's/#" " save \"\"/save \"\"/g' %s/redis.conf") redis_vm.RemoteCommand(sed_cmd % redis_server.GetRedisDir()) for i in range(GetNumRedisServers(redis_vm)): port = FIRST_PORT + i redis_vm.RemoteCommand( 'cp %s/redis.conf %s/redis-%d.conf' % (redis_server.GetRedisDir(), redis_server.GetRedisDir(), port)) redis_vm.RemoteCommand( r'sed -i -e "s/port 6379/port %d/g" %s/redis-%d.conf' % (port, redis_server.GetRedisDir(), port)) redis_vm.RemoteCommand( 'nohup sudo %s/src/redis-server %s/redis-%d.conf &> /dev/null &' % (redis_server.GetRedisDir(), redis_server.GetRedisDir(), port)) args = [((vm, ), {}) for vm in vms[1:]] vm_util.RunThreaded(PrepareLoadgen, args)
def Prepare(bm_spec: _BenchmarkSpec) -> None: """Install Redis on one VM and memtier_benchmark on another.""" vms = bm_spec.vms redis_vm = vms[0] # Install latest redis on the 1st machine. redis_vm.Install('redis_server') redis_server.Configure(redis_vm) redis_server.Start(redis_vm) # Remove snapshotting redis_dir = redis_server.GetRedisDir() sed_cmd = ( r"sed -i -e '/save 900/d' -e '/save 300/d' -e '/save 60/d' -e 's/#" f" save \"\"/save \"\"/g' {redis_dir}/redis.conf") redis_vm.RemoteCommand(sed_cmd) vm_util.RunThreaded(PrepareLoadgen, vms) for i in range(GetNumRedisServers(redis_vm)): port = FIRST_PORT + i redis_vm.RemoteCommand( f'cp {redis_dir}/redis.conf {redis_dir}/redis-{port}.conf') redis_vm.RemoteCommand( rf'sed -i -e "s/port 6379/port {port}/g" {redis_dir}/redis-{port}.conf' ) redis_vm.RemoteCommand(f'nohup sudo {redis_dir}/src/redis-server ' f'{redis_dir}/redis-{port}.conf &> /dev/null &') # Pre-populate the redis server(s) with data redis_vm.RemoteCommand( f'memtier_benchmark -s localhost -p {port} ' f'-d {FLAGS.memtier_data_size} -t {LOAD_THREAD} -c {LOAD_CLIENT} ' f'--ratio 1:0 --key-pattern {FLAGS.memtier_key_pattern} ' f'--pipeline {LOAD_PIPELINE} --key-minimum {START_KEY} ' f'--key-maximum {FLAGS.memtier_requests} -n allkeys ')
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)
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. """ vms = benchmark_spec.vms redis_vm = vms[0] # Install latest redis on the 1st machine. redis_vm.Install('redis_server') redis_server.Configure(redis_vm) redis_server.Start(redis_vm) # Remove snapshotting sed_cmd = ( r"sed -i -e '/save 900/d' -e '/save 300/d' -e '/save 60/d' -e 's/#" " save \"\"/save \"\"/g' %s/redis.conf") redis_vm.RemoteCommand(sed_cmd % redis_server.GetRedisDir()) args = [((vm, ), {}) for vm in vms] vm_util.RunThreaded(PrepareLoadgen, args) for i in range(GetNumRedisServers(redis_vm)): port = FIRST_PORT + i redis_vm.RemoteCommand( 'cp %s/redis.conf %s/redis-%d.conf' % (redis_server.GetRedisDir(), redis_server.GetRedisDir(), port)) redis_vm.RemoteCommand( r'sed -i -e "s/port 6379/port %d/g" %s/redis-%d.conf' % (port, redis_server.GetRedisDir(), port)) redis_vm.RemoteCommand( 'nohup sudo %s/src/redis-server %s/redis-%d.conf &> /dev/null &' % (redis_server.GetRedisDir(), redis_server.GetRedisDir(), port)) # Pre-populate the redis server(s) with data redis_vm.RemoteCommand( 'memtier_benchmark -s localhost -p %d -d %s -t %d -c %d ' '--ratio 1:0 --key-pattern %s --pipeline %d ' '--key-minimum %d --key-maximum %d -n allkeys ' % (port, FLAGS.memtier_data_size, LOAD_THREAD, LOAD_CLIENT, FLAGS.memtier_key_pattern, LOAD_PIPELINE, START_KEY, FLAGS.memtier_requests))
def PrepareServer(redis_vm): redis_vm.Install('redis_server') redis_server.Configure(redis_vm) redis_server.Start(redis_vm)