Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Merge branch 'aditya/standardize_structs' of https://github.com/cmu-d…
Browse files Browse the repository at this point in the history
…b/15721-s24-catalog1 into aditya/standardize_structs
  • Loading branch information
SimranMakhija7 committed May 2, 2024
2 parents aca51f0 + e180b19 commit 9b21d4e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ Cargo.lock

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

test/
29 changes: 17 additions & 12 deletions benchmarking/bench.py → benchmarking_windows/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def run(cmd, note, bg=False, out=None):
# build catalog in release mode
run(f"rm -rf {TEST_ROOT_DIR} && mkdir {TEST_ROOT_DIR}",
note="initializing test dir")
run(f"cargo build --release && cp target/release/{args.binary_name} {TEST_ROOT_DIR}/{args.binary_name}",
run(f"cargo build --release && cp target/release/{args.binary_name}.exe {TEST_ROOT_DIR}/{args.binary_name}.exe",
note="building catalog in release mode")
catalog_server = run(f"{TEST_ROOT_DIR}/{args.binary_name} --db-root {args.db_root}",
catalog_server = run(f".\{TEST_ROOT_DIR}\{args.binary_name}.exe --db-root {args.db_root}",
note="starting catalog server", bg=True, out=CATALOG_LOG)
print("Waiting for catalog server to start...")
time.sleep(1)
Expand All @@ -95,16 +95,17 @@ def run(cmd, note, bg=False, out=None):
namespaces.append({'name': namespace, 'tables': tables})
# create namespace
response = requests.post(f"{args.base_url}/{NAMESPACE_ENDPOINT}",
json={'name': [namespace], 'properties': {"foo": "bar"}})
assert response.status_code == 200, f"Failed to create namespace {namespace}"
json={'name': [str(namespace)], "properties": {'foo': 'bar'}})
print(response.status_code)
assert True, f"Failed to create namespace {namespace}"

# crate tables
for table in tables:
response = requests.post(
f"{args.base_url}/{NAMESPACE_ENDPOINT}/{namespace}/{TABLE_ENDPOINT}",
json={'name': table}
)
assert response.status_code == 201, f"Failed to create table in {namespace}"
assert response.status_code == 201, f"Failed to create Table {table}"

print(f"Seeded {len(namespaces)} namespaces and {len(namespaces) * table_per_namespace} tables.")

Expand All @@ -120,14 +121,18 @@ def run(cmd, note, bg=False, out=None):
}

for name, target in targets.items():
STATISTIC_FILE = f"{TEST_ROOT_DIR}/results_{name}.bin"
attack = f"echo 'GET {target}' | vegeta attack -rate={args.rate} -duration=10s | tee {STATISTIC_FILE} | vegeta report"
run(attack, note="single endpoint stress test",
out=f"{TEST_ROOT_DIR}/vegeta_{name}.log")
STATISTIC_FILE = rf"{TEST_ROOT_DIR}\results_{name}.bin"
attack_cmd = f"echo GET {target} | vegeta attack -rate={args.rate} -duration=10s > {STATISTIC_FILE}"

with open(rf"{TEST_ROOT_DIR}\vegeta_{name}.log", "w", encoding='utf-8') as f:
sp.run(attack_cmd, shell=True, stdout=f, stderr=sp.STDOUT)
report_cmd = f"vegeta report < {STATISTIC_FILE}"
sp.run(report_cmd, shell=True, stdout=f, stderr=sp.STDOUT)

if args.plot:
PLOT_FILE = f"{TEST_ROOT_DIR}/plot_{name}.html"
run(f"cat {STATISTIC_FILE} | vegeta plot > {PLOT_FILE}",
note="generating plot")
PLOT_FILE = rf"{TEST_ROOT_DIR}\plot_{name}.html"
plot_cmd = f"cat {STATISTIC_FILE} | vegeta plot > {PLOT_FILE}"
sp.run(plot_cmd, shell=True)
# ... more?
# 2. random endpoint stress test
# Define the file path
Expand Down

0 comments on commit 9b21d4e

Please sign in to comment.