예제 #1
0
    def test_01(self):  # pylint: disable=no-self-use
        params = dict(alternator_port=8080
                      )  # , dynamodb_primarykey_type='HASH_AND_RANGE')
        loader_set = LoaderSetDummy()
        thread1 = YcsbStressThread(
            loader_set,
            'bin/ycsb load dynamodb -P workloads/workloada -threads 250 -p recordcount=50000000 -p fieldcount=10 -p fieldlength=1024 -s',
            70,
            'None',
            node_list=[DbNode()],
            params=params)

        thread2 = YcsbStressThread(
            loader_set,
            'bin/ycsb run dynamodb -P workloads/workloada -threads 100 -p recordcount=50000000 -p fieldcount=10 -p fieldlength=1024 -p operationcount=10000 -s',
            70,
            'None',
            node_list=[DbNode()],
            params=params)

        try:
            thread1.run()
            time.sleep(10)
            thread2.run()
            thread1.get_results()
        except Exception:
            logging.exception("failed")
            raise

        finally:
            loader_set.nodes[0].remoter.run(
                'pgrep -f ycsb | xargs -I{}  kill -TERM -{}',
                ignore_status=True)
예제 #2
0
def test_01_dynamodb_api(request, docker_scylla, prom_address):
    loader_set = LocalLoaderSetDummy()

    cmd = 'bin/ycsb run dynamodb -P workloads/workloada -threads 5 -p recordcount=1000000 ' \
          '-p fieldcount=10 -p fieldlength=1024 -p operationcount=200200300 -s'
    ycsb_thread = YcsbStressThread(loader_set, cmd, node_list=[docker_scylla], timeout=5, params=TEST_PARAMS)

    def cleanup_thread():
        ycsb_thread.kill()

    request.addfinalizer(cleanup_thread)

    ycsb_thread.run()

    @timeout(timeout=60)
    def check_metrics():
        output = requests.get("http://{}/metrics".format(prom_address)).text
        regex = re.compile(r'^collectd_ycsb_read_gauge.*?([0-9\.]*?)$', re.MULTILINE)
        assert 'collectd_ycsb_read_gauge' in output
        assert 'collectd_ycsb_update_gauge' in output

        matches = regex.findall(output)
        assert all(float(i) > 0 for i in matches), output

    check_metrics()

    output = ycsb_thread.get_results()
    assert 'latency mean' in output[0]
    assert float(output[0]['latency mean']) > 0

    assert 'latency 99th percentile' in output[0]
    assert float(output[0]['latency 99th percentile']) > 0
예제 #3
0
def test_02_dynamodb_api_dataintegrity(request, docker_scylla, prom_address,
                                       events):
    loader_set = LocalLoaderSetDummy()

    # 2. do write without dataintegrity=true
    cmd = 'bin/ycsb load dynamodb -P workloads/workloada -threads 5 ' \
          '-p recordcount=50 -p fieldcount=1 -p fieldlength=100'
    ycsb_thread1 = YcsbStressThread(loader_set,
                                    cmd,
                                    node_list=[docker_scylla],
                                    timeout=30,
                                    params=TEST_PARAMS)

    def cleanup_thread1():
        ycsb_thread1.kill()

    request.addfinalizer(cleanup_thread1)

    ycsb_thread1.run()
    ycsb_thread1.get_results()
    ycsb_thread1.kill()

    # 3. do read with dataintegrity=true
    cmd = 'bin/ycsb run dynamodb -P workloads/workloada -threads 5 -p recordcount=100 ' \
          '-p fieldcount=10 -p fieldlength=512 -p dataintegrity=true -p operationcount=100000000'
    ycsb_thread2 = YcsbStressThread(loader_set,
                                    cmd,
                                    node_list=[docker_scylla],
                                    timeout=30,
                                    params=TEST_PARAMS)

    def cleanup_thread2():
        ycsb_thread2.kill()

    request.addfinalizer(cleanup_thread2)

    ycsb_thread2.run()

    # 4. wait for expected metrics to be available
    @timeout(timeout=60)
    def check_metrics():
        output = requests.get("http://{}/metrics".format(prom_address)).text
        regex = re.compile(r'^collectd_ycsb_verify_gauge.*?([0-9\.]*?)$',
                           re.MULTILINE)

        assert 'collectd_ycsb_verify_gauge' in output
        assert 'type="UNEXPECTED_STATE"' in output
        assert 'type="ERROR"' in output
        matches = regex.findall(output)
        assert all(float(i) >= 0 for i in matches), output

    check_metrics()
    file_logger = events.get_events_logger()
    with events.wait_for_n_events(file_logger, count=7, timeout=60):
        ycsb_thread2.get_results()

    # 5. check that events with the expected error were raised
    cat = file_logger.get_events_by_category()
    assert len(cat['ERROR']) == 2
    assert '=UNEXPECTED_STATE' in cat['ERROR'][0]
    assert '=ERROR' in cat['ERROR'][1]
def test_01_kcl_with_ycsb(request, docker_scylla, events):  # pylint: disable=too-many-locals
    loader_set = LocalLoaderSetDummy()
    num_of_keys = 1000
    # 1. start kcl thread and ycsb at the same time
    ycsb_cmd = f'bin/ycsb load dynamodb  -P workloads/workloada -p recordcount={num_of_keys} -p dataintegrity=true ' \
               f'-p insertorder=uniform -p insertcount={num_of_keys} -p fieldcount=2 -p fieldlength=5'
    ycsb_thread = YcsbStressThread(loader_set, ycsb_cmd, node_list=[docker_scylla], timeout=600, params=TEST_PARAMS)

    kcl_cmd = f"hydra-kcl -t usertable -k {num_of_keys}"
    kcl_thread = KclStressThread(loader_set, kcl_cmd, node_list=[docker_scylla], timeout=600, params=TEST_PARAMS)
    stress_cmd = 'table_compare interval=20; src_table="alternator_usertable".usertable; ' \
                 'dst_table="alternator_usertable-dest"."usertable-dest"'
    compare_sizes = CompareTablesSizesThread(
        loader_set=loader_set, stress_cmd=stress_cmd, node_list=[docker_scylla], timeout=600, params=TEST_PARAMS)

    def cleanup_thread():
        ycsb_thread.kill()
        kcl_thread.kill()

    request.addfinalizer(cleanup_thread)

    time.sleep(60)
    kcl_thread.run()
    time.sleep(30)
    ycsb_thread.run()

    compare_sizes.run()
    compare_sizes.get_results()

    output = ycsb_thread.get_results()
    assert 'latency mean' in output[0]
    assert float(output[0]['latency mean']) > 0

    assert 'latency 99th percentile' in output[0]
    assert float(output[0]['latency 99th percentile']) > 0

    output = kcl_thread.get_results()
    logging.debug(output)

    error_log_content_before = events.get_event_log_file('error.log')

    # 2. do read with dataintegrity=true
    cmd = f'bin/ycsb run dynamodb -P workloads/workloada -p recordcount={num_of_keys} -p insertorder=uniform ' \
          f'-p insertcount={num_of_keys} -p fieldcount=2 -p fieldlength=5 -p dataintegrity=true ' \
          f'-p operationcount={num_of_keys}'
    ycsb_thread2 = YcsbStressThread(loader_set, cmd, node_list=[docker_scylla], timeout=500, params=TEST_PARAMS)

    def cleanup_thread2():
        ycsb_thread2.kill()

    request.addfinalizer(cleanup_thread2)

    ycsb_thread2.run()
    ycsb_thread2.get_results()

    # 3. check that events with errors weren't raised
    error_log_content_after = events.get_event_log_file('error.log')
    assert error_log_content_after == error_log_content_before
def test_02_dynamodb_api_dataintegrity(request, docker_scylla, prom_address,
                                       events):
    loader_set = LocalLoaderSetDummy()

    error_log_content_before = events.get_event_log_file('error.log')

    # 2. do write without dataintegrity=true
    cmd = 'bin/ycsb load dynamodb -P workloads/workloada -threads 5 -p recordcount=10000 -p fieldcount=10 -p fieldlength=512'
    ycsb_thread1 = YcsbStressThread(loader_set,
                                    cmd,
                                    node_list=[docker_scylla],
                                    timeout=5,
                                    params=TEST_PARAMS)

    def cleanup_thread1():
        ycsb_thread1.kill()

    request.addfinalizer(cleanup_thread1)

    ycsb_thread1.run()
    ycsb_thread1.get_results()
    ycsb_thread1.kill()

    # 3. do read with dataintegrity=true
    cmd = 'bin/ycsb run dynamodb -P workloads/workloada -threads 5 -p recordcount=10000 -p fieldcount=10 -p fieldlength=512 -p dataintegrity=true -p hdrhistogram.summary.addstatus=true -p operationcount=100000000'
    ycsb_thread2 = YcsbStressThread(loader_set,
                                    cmd,
                                    node_list=[docker_scylla],
                                    timeout=20,
                                    params=TEST_PARAMS)

    def cleanup_thread2():
        ycsb_thread2.kill()

    request.addfinalizer(cleanup_thread2)

    ycsb_thread2.run()

    # 4. wait for expected metrics to be available
    @timeout(timeout=60)
    def check_metrics():
        output = requests.get("http://{}/metrics".format(prom_address)).text
        regex = re.compile(r'^collectd_ycsb_verify_gauge.*?([0-9\.]*?)$',
                           re.MULTILINE)

        assert 'collectd_ycsb_verify_gauge' in output
        assert 'UNEXPECTED_STATE' in output
        matches = regex.findall(output)
        assert all(float(i) >= 0 for i in matches), output

    check_metrics()
    ycsb_thread2.get_results()

    # 5. check that events with the expected error were raised
    error_log_content_after = events.wait_for_event_log_change(
        'error.log', error_log_content_before)
    assert 'UNEXPECTED_STATE' in error_log_content_after