Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 31 minutes ago History
seed_tsv.py · 1.7 KB · 45 lines
1#!/usr/bin/env python3
2"""Seed a throwaway data dir and request-URL lists for the HTTP benchmark.
3
4 python seed_tsv.py DATA_DIR URL_DIR BASE_URL ROWS
5
6Creates, directly on disk (plain TSV + schema JSON, like the repo's tests):
7 bench classic, ROWS rows -- read and update targets
8 bench_log append, ROWS rows -- create target (append mode)
9 bench_small classic, 1000 rows -- create target (classic mode)
10
11and writes URL files (one URL per line) that oha cycles through, so the
12requests hit random ids/offsets instead of one hot row. A fixed seed means
13every server variant sees the identical request sequence.
14"""
15from __future__ import annotations
16
17import random
18import sys
19from pathlib import Path
20
21sys.path.insert(0, str(Path(__file__).resolve().parent))
22from storage_bench import seed # noqa: E402
23
24
25def main() -> int:
26 data_dir, url_dir, base, rows = Path(sys.argv[1]), Path(sys.argv[2]), sys.argv[3].rstrip("/"), int(sys.argv[4])
27 url_dir.mkdir(parents=True, exist_ok=True)
28 seed(data_dir, "bench", rows, "classic")
29 seed(data_dir, "bench_log", rows, "append")
30 seed(data_dir, "bench_small", 1000, "classic")
31
32 rng = random.Random(777)
33 n = 2000
34 (url_dir / "get_one.txt").write_text(
35 "\n".join(f"{base}/collections/bench/records/r{rng.randrange(rows)}" for _ in range(n)) + "\n")
36 (url_dir / "list_page.txt").write_text(
37 "\n".join(f"{base}/collections/bench/records?limit=50&offset={rng.randrange(max(1, rows - 50))}"
38 for _ in range(n)) + "\n")
39 (url_dir / "update_one.txt").write_text(
40 "\n".join(f"{base}/collections/bench/records/r{rng.randrange(rows)}" for _ in range(n)) + "\n")
41 return 0
42
43
44if __name__ == "__main__":
45 raise SystemExit(main())