def __init__(self, argv): l.info(" Starting Max Rate ....") pwd = os.getcwd() def options(): None setattr(options, 'test_duration', 15) setattr(options, 'msg_batch', 50) setattr(options, 'msg_rate', 30000) setattr(options, 'config_file', pwd + '/hydra.ini') setattr(options, 'keep_running', False) setattr(options, 'acks', 0) setattr(options, 'linger_ms', 0) setattr(options, 'consumer_max_buffer_size', 0) self.first_test = None # Parameters client_set = [30] for client_count in client_set: setattr(options, 'total_sub_apps', int(client_count / 10)) if not self.first_test: runner = RunTestKAFKA(options, None) self.first_test = runner self.first_test.start_appserver() else: runner = RunTestKAFKA(options, None) scanner = Scanner(runner.run, 500) res = scanner.range(range(10000, 14000, 2000)) l.info("Found for Client Count %d :" % client_count) l.info(" :: " + pformat(res)) runner.delete_all_launched_apps() self.first_test.stop_appserver() l.info("TestSuite Completed.") sys.exit(0)
def __init__(self, argv): l.info(" Starting Max Rate ....") pwd = os.getcwd() fname = 'rmqsuit.test.log' ofile = open(pwd + '/' + fname, 'w') ofile.truncate() ofile.write('Starting at :' + datetime.now().strftime("%Y-%m-%d %H:%M:%S") + '\n') # def options = lambda: None # NOQA def options(): None setattr(options, 'test_duration', 30) setattr(options, 'msg_batch', 50) setattr(options, 'msg_rate', 1000) setattr(options, 'config_file', pwd + '/hydra.ini') setattr(options, 'keep_running', False) self.first_test = None # Parameters client_set = [100] for client_count in client_set: setattr(options, 'total_sub_apps', int(client_count / 10)) if not self.first_test: runner = RunTestRMQ(options, None) self.first_test = runner self.first_test.start_appserver() else: runner = RunTestRMQ(options, None) scanner = Scanner(runner.run, 500) res = scanner.range(range(10000, 14000, 2000)) l.info("Found for Client Count %d :" % client_count) l.info(" :: " + pformat(res)) runner.delete_all_launched_apps() self.first_test.stop_appserver() l.info("TestSuite Compleated.") sys.exit(0)
def __init__(self, options): l.info(" Starting Max Rate ....") pwd = os.getcwd() fname = 'kafkasuit.test.log' ofile = open(pwd + '/' + fname, 'w') ofile.truncate() ofile.write('Starting at :' + datetime.now().strftime("%Y-%m-%d %H:%M:%S") + '\n') # setattr(options, 'test_duration', 15) setattr(options, 'msg_batch', 100) setattr(options, 'msg_rate', 10000) setattr(options, 'keep_running', False) setattr(options, 'acks', 0) setattr(options, 'linger_ms', 0) setattr(options, 'consumer_max_buffer_size', 0) self.first_test = None # Parameters client_set = [30, 60, 120, 240, 480, 960, 1920, 3840, 7680, 10000] for client_count in client_set: setattr(options, 'total_sub_apps', int(client_count / 10)) if not self.first_test: runner = RunTestKAFKA(options, None) self.first_test = runner self.first_test.start_appserver() else: # Keep the old runner # But rescale the app runner.set_options(options) runner.scale_sub_app() if client_count < 50: scanner = Scanner(runner.run, 30000) elif client_count < 200: scanner = Scanner(runner.run, 10000) else: scanner = Scanner(runner.run, 500) (status, rate, drop) = scanner.find_max_rate() l.info("Found for Client Count %d Max message Rate %d with drop %f" % (client_count, rate, drop)) maxrate_drop = drop maxrate_rate = rate if True and maxrate_drop != 0: l.info("Searching for no-drop rate") scanner_drop = Scanner(runner.run, maxrate_rate / 2) (status, step_cnt, nodrop, nodrop_rate) = scanner_drop.search(0.5, 0.01) l.info("Found for Client Count %d Max message Rate %d with no drop (%f)" % (client_count, nodrop_rate, nodrop)) else: nodrop_rate = rate # Delete all launched apps once the required drop is achieved for this set runner.delete_all_launched_apps() self.first_test.stop_appserver() l.info("TestSuite Completed.") sys.exit(0)
def __init__(self, options): l.info(" Starting Fixed Rate ....") print("print Starting Fixed Rate ....") pwd = os.getcwd() fname = 'zmqsuit.test.log' ofile = open(pwd + '/' + fname, 'w') ofile.truncate() ofile.write('Starting at :' + datetime.now().strftime("%Y-%m-%d %H:%M:%S") + '\n') # def options = lambda: None # NOQA # setattr(options, 'test_duration', 30) # setattr(options, 'msg_batch', 50) setattr(options, 'msg_rate', 10000) setattr(options, 'total_sub_apps', 30) setattr(options, 'config_file', pwd + '/hydra.ini') setattr(options, 'keep_running', False) l.info("RUNNING WITH c_sub=" + pformat(options.c_sub) + " c_pub=" + pformat(options.c_pub)) self.first_test = None # Parameters # client_set = [5, 10, 50, 100, 200, 500, 1000, 2000, 5000, 10000] client_set = [80] # client_set = [5, 10, 50, 100, 200, 400] for client_count in client_set: setattr(options, 'total_sub_apps', int(client_count / 10)) if not self.first_test: runner = RunTestZMQ(options, None) self.first_test = runner self.first_test.start_appserver() else: runner.set_options(options) runner.scale_sub_app() # runner = RunTestZMQ(options, None) scanner = Scanner(runner.run, 500) res = scanner.range(range(35000, 100000, 1000)) l.info("Found for Client Count %d :" % client_count) l.info(" :: " + pformat(res)) runner.delete_all_launched_apps() self.first_test.stop_appserver() l.info("TestSuite Compleated.") sys.exit(0)
def __init__(self, options): l.info(" Starting Max Rate ....") pwd = os.getcwd() fname = 'zmqsuit.test.log' ofile = open(pwd + '/' + fname, 'w') ofile.truncate() ofile.write('Starting at :' + datetime.now().strftime("%Y-%m-%d %H:%M:%S") + '\n') # def options = lambda: None # NOQA # setattr(options, 'test_duration', 15) # setattr(options, 'msg_batch', 100) setattr(options, 'msg_rate', 10000) setattr(options, 'keep_running', False) setattr(options, 'slow_clients_percent', 0) setattr(options, 'rec_clients_percent', 0) # setattr(options, 'c_sub', True) # setattr(options, 'c_pub', True) # setattr(options, 'c_sub', False) # setattr(options, 'c_pub', False) l.info("RUNNING WITH c_sub=" + pformat(options.c_sub) + " c_pub=" + pformat(options.c_pub)) self.first_test = None # Parameters client_set = [30, 60, 90, 180, 500, 1000, 2000, 4000, 8000] # client_set = [1000, 2000, 4000, 8000] slow_clients_percent = 10 # percentage of slow clients slow_clients_rate_pc = 0.5 # percentage of zero drop rate for slow clients reconnecting_clients_percent = 10 # Percentage of reconnecting clients reconnecting_clients_rate = 2 # reconnect per sec for client_count in client_set: setattr(options, 'total_sub_apps', int(client_count / 10)) setattr(options, 'slow_clients_percent', 0) setattr(options, 'reconnecting_clients_percent', 0) if not self.first_test: runner = RunTestZMQ(options, None) self.first_test = runner self.first_test.start_appserver() else: # Keep the old runner # runner = RunTestZMQ(options, None) # But rescale the app runner.set_options(options) runner.scale_sub_app() if client_count < 50: scanner = Scanner(runner.run, 30000) elif client_count < 200: scanner = Scanner(runner.run, 10000) else: scanner = Scanner(runner.run, 500) (status, rate, drop) = scanner.find_max_rate() l.info( "Found for Client Count %d Max message Rate %d with drop %f" % (client_count, rate, drop)) maxrate_drop = drop maxrate_rate = rate if True and maxrate_drop != 0: l.info("Searching for no-drop rate") scanner_drop = Scanner(runner.run, maxrate_rate / 2) (status, step_cnt, nodrop, nodrop_rate) = scanner_drop.search(0.5, 0.01) l.info( "Found for Client Count %d Max message Rate %d with no drop (%f)" % (client_count, nodrop_rate, nodrop)) else: nodrop_rate = rate # if True and nodrop2: # l.info("Searching for < 1% drop rate") # scanner_drop = Scanner(runner.run, rate / 1.5) # (status, step_cnt, drop, rate) = scanner_drop.search(1, 0.01) # l.info("Found for Client Count %d Max message Rate %d with < 1pc drop (%f)" % # (client_count, rate, drop)) if False and options.flaky_clients: l.info("Searching for no-drop rate with flakey clients") setattr(options, 'slow_clients_percent', slow_clients_percent) setattr(options, 'slow_clients_rate', slow_clients_rate_pc * nodrop_rate) setattr(options, 'rec_clients_percent', 0) setattr(options, 'rec_clients_rate', reconnecting_clients_rate) runner.set_options(options) scanner_flakey1 = Scanner(runner.run, maxrate_rate / 2) (status, step_cnt, f1_nodrop, f1_nodrop_rate) = scanner_flakey1.search(0.01, 0.01) l.info( "Found for Client Count %d Max message Rate %d with Slow Client and no drop (%f)" % (client_count, f1_nodrop_rate, f1_nodrop)) l.info("Searching for no-drop rate with flakey clients") setattr(options, 'slow_clients_percent', 0) setattr(options, 'slow_clients_rate', slow_clients_rate_pc * nodrop_rate) setattr(options, 'rec_clients_rate', reconnecting_clients_rate) runner.set_options(options) scanner_flakey2 = Scanner(runner.run, maxrate_rate / 2) (status, step_cnt, f2_nodrop, f2_nodrop_rate) = scanner_flakey2.search(0.01, 0.01) l.info( "Found for Client Count %d Max message Rate %d with Reconnect Client and no drop (%f)" % (client_count, f2_nodrop_rate, f2_nodrop)) if True and options.flaky_clients: l.info("Searching for no-drop rate with flakey clients") setattr(options, 'slow_clients_percent', slow_clients_percent) setattr(options, 'slow_clients_rate', slow_clients_rate_pc * nodrop_rate) setattr(options, 'rec_clients_percent', 0) setattr(options, 'rec_clients_rate', reconnecting_clients_rate) runner.set_options(options) scanner_flakey1 = Scanner(runner.run, maxrate_rate / 2) (status, step_cnt, f1_nodrop, f1_nodrop_rate) = scanner_flakey1.search(0.5, 0.01) l.info( "Found for Client Count %d Max message Rate %d with Slow Client and no drop (%f)" % (client_count, f1_nodrop_rate, f1_nodrop)) l.info("Searching for no-drop rate with flakey clients") setattr(options, 'slow_clients_percent', 0) setattr(options, 'slow_clients_rate', slow_clients_rate_pc * nodrop_rate) setattr(options, 'rec_clients_percent', reconnecting_clients_percent) setattr(options, 'rec_clients_rate', reconnecting_clients_rate) runner.set_options(options) scanner_flakey2 = Scanner(runner.run, maxrate_rate / 2) (status, step_cnt, f2_nodrop, f2_nodrop_rate) = scanner_flakey2.search(0.5, 0.01) l.info( "Found for Client Count %d Max message Rate %d with Reconnect Client and no drop (%f)" % (client_count, f2_nodrop_rate, f2_nodrop)) # Delete all launched apps once the required drop is achieved for this set runner.delete_all_launched_apps() self.first_test.stop_appserver() l.info("TestSuite Compleated.") sys.exit(0)
def setUp(self): self.mocgen = MocGen() self.scanner = Scanner(self.mocgen.generate, 1000)
class ScannerUnitTest(unittest.TestCase): def setUp(self): self.mocgen = MocGen() self.scanner = Scanner(self.mocgen.generate, 1000) def test1(self): dt = 12345 self.mocgen.run_for_exp(self, dt, 1, dt, 0.0001) def test2(self): dt = 2345 self.mocgen.run_for_exp(self, dt, 0, 2344, 0.001) def test3(self): dt = 345 self.mocgen.run_for_exp(self, dt, 2, 344, 0.01) def test4(self): dt = 99999 self.mocgen.run_for_exp(self, dt, -2, 99992, 0.0001) def test5(self): dt = 1024 self.mocgen.run_for_exp(self, dt, 1, 1023, 0.001) def test6(self): dt = 128 self.mocgen.run_for_exp(self, dt, 4, dt, 0.01) def test7(self): dt = 2000 self.mocgen.run_for_exp(self, dt, 0, 1998, 0.001) def test8(self): dt = 3000 self.mocgen.run_for_exp(self, dt, 0, 2998, 0.001) def test9(self): self.mocgen.set_expected_response(10000, 1) self.mocgen.set_expected_response(12012, 10) self.mocgen.set_expected_response(13120, 20) perr = 0.001 (sts, step_cnt, res_err, res) = self.scanner.search(0, perr) self.assertEqual(step_cnt, 14) res = int(res + 0.5) self.assertEqual(res, 9992) (sts, step_cnt, res_err, res) = self.scanner.search(1, perr) self.assertEqual(step_cnt, 14) res = int(res + 0.5) self.assertEqual(res, 12008) (sts, step_cnt, res_err, res) = self.scanner.search(5, perr) self.assertEqual(step_cnt, 14) res = int(res + 0.5) self.assertEqual(res, 12008) (sts, step_cnt, res_err, res) = self.scanner.search(15, 0.0001) res = int(res + 0.5) self.assertEqual(res, 13120) self.assertEqual(step_cnt, 17) def test10(self): def tfn1(val): # create a random function r = random.randint(10, 100) if (val + r) > 1000: return 10 return 0 def tfn2(val): # create a random function r = random.randint(10, 500) if (val + r) > 10000: return 20 return 10 self.mocgen.set_expected_responsefn(1000, tfn1) self.mocgen.set_expected_responsefn(10000, tfn2) (sts, step_cnt, res_err, res) = self.scanner.search(15, 0.001) # pprint("----> step_cnt %d res %d" % (step_cnt, res)) self.assertEqual(step_cnt, 14) self.assertTrue(abs(res - 9994) < 100) (sts, step_cnt, res_err, res) = self.scanner.search(5, 0.0001) # pprint("----> step_cnt %d res %d" % (step_cnt, res)) self.assertEqual(step_cnt, 14) self.assertTrue(abs(res - 994) < 100) def test11(self): return True data = [(500, 979, 0.0), (1000, 1016, 0.0), (2000, 2014, 0.0), (4000, 4013, 0.0), (8000, 8009, 0.0), (16000, 16005, 0.0), (32000, 23077, 14.49), (24000, 23957, 0.18), (28000, 24188, 13.17), (26000, 24570, 4.88), (27000, 24521, 8.92), (27500, 27357, 0.0), (27750, 26011, 5.54), (27875, 27606, 0.97), (27937, 26301, 4.4)] def tfn1(val): # create a random function r = random.randint(10, 100) if (val + r) > 1000: return 10 return 0 def tfn2(val): # create a random function r = random.randint(10, 500) if (val + r) > 10000: return 20 return 10 self.mocgen.set_expected_responsefn(1000, tfn1) self.mocgen.set_expected_responsefn(10000, tfn2) (sts, step_cnt, res_err, res) = self.scanner.search(15) # pprint("----> step_cnt %d res %d" % (step_cnt, res)) self.assertEqual(step_cnt, 16) self.assertTrue(abs(res - 9994) < 100) (sts, step_cnt, res_err, res) = self.scanner.search(5) # pprint("----> step_cnt %d res %d" % (step_cnt, res)) self.assertEqual(step_cnt, 9) self.assertTrue(abs(res - 994) < 100) pprint(pformat(data))
def __init__(self, options): l.info(" Starting Max Rate ....") pwd = os.getcwd() fname = 'zmqsuit.test.log' ofile = open(pwd + '/' + fname, 'w') ofile.truncate() ofile.write('Starting at :' + datetime.now().strftime("%Y-%m-%d %H:%M:%S") + '\n') # def options = lambda: None # NOQA # setattr(options, 'test_duration', 15) # setattr(options, 'msg_batch', 100) setattr(options, 'msg_rate', 10000) setattr(options, 'keep_running', False) setattr(options, 'slow_clients_percent', 0) setattr(options, 'rec_clients_percent', 0) # setattr(options, 'c_sub', True) # setattr(options, 'c_pub', True) # setattr(options, 'c_sub', False) # setattr(options, 'c_pub', False) l.info("RUNNING WITH c_sub=" + pformat(options.c_sub) + " c_pub=" + pformat(options.c_pub)) self.first_test = None # Parameters client_set = [30, 60, 90, 180, 500, 1000, 2000, 4000, 8000] # client_set = [1000, 2000, 4000, 8000] slow_clients_percent = 10 # percentage of slow clients slow_clients_rate_pc = 0.5 # percentage of zero drop rate for slow clients reconnecting_clients_percent = 10 # Percentage of reconnecting clients reconnecting_clients_rate = 2 # reconnect per sec for client_count in client_set: setattr(options, 'total_sub_apps', int(client_count / 10)) setattr(options, 'slow_clients_percent', 0) setattr(options, 'reconnecting_clients_percent', 0) if not self.first_test: runner = RunTestZMQ(options, None) self.first_test = runner self.first_test.start_appserver() else: # Keep the old runner # runner = RunTestZMQ(options, None) # But rescale the app runner.set_options(options) runner.scale_sub_app() if client_count < 50: scanner = Scanner(runner.run, 30000) elif client_count < 200: scanner = Scanner(runner.run, 10000) else: scanner = Scanner(runner.run, 500) (status, rate, drop) = scanner.find_max_rate() l.info("Found for Client Count %d Max message Rate %d with drop %f" % (client_count, rate, drop)) maxrate_drop = drop maxrate_rate = rate if True and maxrate_drop != 0: l.info("Searching for no-drop rate") scanner_drop = Scanner(runner.run, maxrate_rate / 2) (status, step_cnt, nodrop, nodrop_rate) = scanner_drop.search(0.5, 0.01) l.info("Found for Client Count %d Max message Rate %d with no drop (%f)" % (client_count, nodrop_rate, nodrop)) else: nodrop_rate = rate # if True and nodrop2: # l.info("Searching for < 1% drop rate") # scanner_drop = Scanner(runner.run, rate / 1.5) # (status, step_cnt, drop, rate) = scanner_drop.search(1, 0.01) # l.info("Found for Client Count %d Max message Rate %d with < 1pc drop (%f)" % # (client_count, rate, drop)) if False and options.flaky_clients: l.info("Searching for no-drop rate with flakey clients") setattr(options, 'slow_clients_percent', slow_clients_percent) setattr(options, 'slow_clients_rate', slow_clients_rate_pc * nodrop_rate) setattr(options, 'rec_clients_percent', 0) setattr(options, 'rec_clients_rate', reconnecting_clients_rate) runner.set_options(options) scanner_flakey1 = Scanner(runner.run, maxrate_rate / 2) (status, step_cnt, f1_nodrop, f1_nodrop_rate) = scanner_flakey1.search(0.01, 0.01) l.info("Found for Client Count %d Max message Rate %d with Slow Client and no drop (%f)" % (client_count, f1_nodrop_rate, f1_nodrop)) l.info("Searching for no-drop rate with flakey clients") setattr(options, 'slow_clients_percent', 0) setattr(options, 'slow_clients_rate', slow_clients_rate_pc * nodrop_rate) setattr(options, 'rec_clients_rate', reconnecting_clients_rate) runner.set_options(options) scanner_flakey2 = Scanner(runner.run, maxrate_rate / 2) (status, step_cnt, f2_nodrop, f2_nodrop_rate) = scanner_flakey2.search(0.01, 0.01) l.info("Found for Client Count %d Max message Rate %d with Reconnect Client and no drop (%f)" % (client_count, f2_nodrop_rate, f2_nodrop)) if True and options.flaky_clients: l.info("Searching for no-drop rate with flakey clients") setattr(options, 'slow_clients_percent', slow_clients_percent) setattr(options, 'slow_clients_rate', slow_clients_rate_pc * nodrop_rate) setattr(options, 'rec_clients_percent', 0) setattr(options, 'rec_clients_rate', reconnecting_clients_rate) runner.set_options(options) scanner_flakey1 = Scanner(runner.run, maxrate_rate / 2) (status, step_cnt, f1_nodrop, f1_nodrop_rate) = scanner_flakey1.search(0.5, 0.01) l.info("Found for Client Count %d Max message Rate %d with Slow Client and no drop (%f)" % (client_count, f1_nodrop_rate, f1_nodrop)) l.info("Searching for no-drop rate with flakey clients") setattr(options, 'slow_clients_percent', 0) setattr(options, 'slow_clients_rate', slow_clients_rate_pc * nodrop_rate) setattr(options, 'rec_clients_percent', reconnecting_clients_percent) setattr(options, 'rec_clients_rate', reconnecting_clients_rate) runner.set_options(options) scanner_flakey2 = Scanner(runner.run, maxrate_rate / 2) (status, step_cnt, f2_nodrop, f2_nodrop_rate) = scanner_flakey2.search(0.5, 0.01) l.info("Found for Client Count %d Max message Rate %d with Reconnect Client and no drop (%f)" % (client_count, f2_nodrop_rate, f2_nodrop)) # Delete all launched apps once the required drop is achieved for this set runner.delete_all_launched_apps() self.first_test.stop_appserver() l.info("TestSuite Compleated.") sys.exit(0)