From dee6557c47e94953d230456569e9ba4974c441d1 Mon Sep 17 00:00:00 2001 From: dormando Date: Sun, 18 Jun 2017 15:26:48 -0700 Subject: automove script: improve algo, add basic test added a devtools/slab_loadgen script for some basic testing of load patterns. can easily add more features (typical variance/reads/inline reload/etc) to further tune algo but was helpful enough as-is. Was able to restart the program with changed configs and watch rebalancer fix itself. rebalancer algo is now much better at pulling slab classes closer together and not ping-ponging, which previous version was doing even with a steady state of sets. --- devtools/slab_loadgen | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 devtools/slab_loadgen (limited to 'devtools') diff --git a/devtools/slab_loadgen b/devtools/slab_loadgen new file mode 100755 index 0000000..357676f --- /dev/null +++ b/devtools/slab_loadgen @@ -0,0 +1,47 @@ +#!/usr/bin/python3 +# Copyright 2017 Facebook +# Licensed under the same terms as memcached itself. + +import argparse +import socket +import sys +import csv +from time import sleep + +parser = argparse.ArgumentParser(description="daemon for emulating set/get pressure") +parser.add_argument("--host", help="host to connect to", + type=str, default="localhost:11211") +parser.add_argument("-s", "--sleep", help="seconds between rounds", + type=int, default="1") +parser.add_argument("-c", "--config", help="load specification file", + type=str, default="./config") + +args = parser.parse_args() + +# prefix, size, count, do_gets +with open(args.config, newline='') as f: + reader = csv.reader(f) + tests = [row for row in reader] + +host, port = args.host.split(':') + +c = socket.create_connection((host, port), 5) +s = c.makefile(mode="rw", buffering=1) + +global_counter = 0 + +while True: + # LATER: stat argument file + # LATER: reload arg file if necessary + for test in tests: + prefix = test[0] + size = int(test[1]) + count = int(test[2]) + do_gets = int(test[3]) + value = 'x'*size + # issue N 'noreply' sets per specified size + for i in range(count): + s.write('set {}{} 0 0 {} noreply\r\n{}\r\n'.format(prefix,global_counter,size,value)) + global_counter += 1 + # TODO: issue N gets per specified size? + sleep(args.sleep) -- cgit v1.2.1