diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-09-23 22:50:50 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2022-09-23 22:50:50 +0200 |
commit | a40c12354257418e686892a7612d7e11a1a58235 (patch) | |
tree | 9d765db5573a262bfa3c3ced72a0ea7edc63c5c7 /scenarios/fragments | |
parent | 700025e4795f2d9bd25173c619905dbfe26f7ec8 (diff) | |
download | mknet-a40c12354257418e686892a7612d7e11a1a58235.tar.gz mknet-a40c12354257418e686892a7612d7e11a1a58235.zip |
Add S3TTFB
Diffstat (limited to 'scenarios/fragments')
-rw-r--r-- | scenarios/fragments/garage.py | 35 | ||||
-rw-r--r-- | scenarios/fragments/s3ttfb.py | 26 |
2 files changed, 53 insertions, 8 deletions
diff --git a/scenarios/fragments/garage.py b/scenarios/fragments/garage.py index 84ca90a..b291321 100644 --- a/scenarios/fragments/garage.py +++ b/scenarios/fragments/garage.py @@ -38,7 +38,7 @@ if 'HOST' in env: config = storage_path / "garage.toml" env['GARAGE_CONFIG_FILE'] = str(config) -def deploy_coord(): +def deploy_coord(gw=None): destroy() shared.log("start daemon") shared.exec(f"{version['path']} --version") @@ -46,7 +46,7 @@ def deploy_coord(): shared.log("discover nodes") connect() shared.log("build layout") - create_layout() + create_layout(gw=gw) shared.log("create key") create_key() shared.log("ready") @@ -136,26 +136,45 @@ def cluster_info(): def connect(): cinf = cluster_info() shared.log("start connections...") - ret = nodes.add_node([n['node_addr'] for n in cinf]) - for st in ret: - if not st.success: - raise Exception("Node connect failed", ret) + while True: + try: + ret = nodes.add_node([n['node_addr'] for n in cinf], _request_timeout=3) + except: + shared.log("not ready, retry in 1sec") + time.sleep(1) + continue + + for st in ret: + if not st.success: + continue + #raise Exception("Node connect failed", ret) + break + shared.log("all nodes connected") -def create_layout(): +def create_layout(gw=None): + if gw is None: + gw = [] + v = layout.get_layout().version cinf = cluster_info() nlay = dict() for n in cinf: + capa = 1 + if n['host'] in gw: + capa = None + nlay[n['node_id']] = NodeClusterInfo( zone = n['zone'], - capacity = 1, + capacity = capa, tags = [ n['host'] ], ) layout.add_layout(nlay) layout.apply_layout(LayoutVersion(version=v+1)) + shared.log(layout.get_layout()) + def create_key(): global key kinfo = shared.fn_retry(lambda: keys.add_key(AddKeyRequest(name="mknet"))) diff --git a/scenarios/fragments/s3ttfb.py b/scenarios/fragments/s3ttfb.py new file mode 100644 index 0000000..66fdcc6 --- /dev/null +++ b/scenarios/fragments/s3ttfb.py @@ -0,0 +1,26 @@ +import os +from os.path import exists +from pathlib import Path +from fragments import shared, minio, garage + +s3bin = Path(os.path.dirname(__file__)) / "../../benchmarks/s3ttfb/s3ttfb" + +def common(): + out = Path(shared.storage_path) / "s3ttfb.csv" + shared.log(f"launching s3ttfb ({s3bin})") + shared.exec(f"{s3bin} > {out}") + shared.log(f"execution done, output written to {out}") + +def on_garage(): + os.environ['AWS_ACCESS_KEY_ID'] = garage.key.access_key_id + os.environ['AWS_SECRET_ACCESS_KEY'] = garage.key.secret_access_key + os.environ['ENDPOINT'] = "localhost:3900" + os.environ['AWS_REGION'] = "garage" + common() + +def on_minio(): + os.environ['AWS_ACCESS_KEY_ID'] = minio.access_key + os.environ['AWS_SECRET_ACCESS_KEY'] = minio.secret_key + os.environ['ENDPOINT'] = "localhost:9000" + os.environ['AWS_REGION'] = "us-east-1" + common() |