diff options
| author | eunhhu <[email protected]> | 2026-10-04 11:07:55 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-04 11:07:55 +0100 |
| commit | 52e51e4231f2e119c97826ae6d6e2f2af0da0c58 (patch) | |
| tree | 0f17ced79a1881bd2b67fbaa9e7ffb823f54b984 /research/experiments/030-app-lifecycle/window.py | |
| parent | 420b749742badd26daf2474e9f157af17be2907f (diff) | |
| download | pure-52e51e4231f2e119c97826ae6d6e2f2af0da0c58.tar.gz pure-52e51e4231f2e119c97826ae6d6e2f2af0da0c58.zip | |
Say what apps that change on a running host showed (017 stage 3, research 115)
Changing an app in place keeps a million items' app answering but for
1.12 ms (a host restart: 150 ms; stopping and starting it again from its
store, as first built, 150.4 ms), 171.5 ms when its records change shape
(332 ms). Another app's p99 stays 0.97 times as it was while one changes
every 0.2 s; a host of one app is as it was (TPC-C +0.7%, instructions
at most +0.02%); each module change leaves 19 KB. 030 holds the windows
of both builds, the isolation, the pairs, the counts and the memory.
Diffstat (limited to 'research/experiments/030-app-lifecycle/window.py')
| -rwxr-xr-x | research/experiments/030-app-lifecycle/window.py | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/research/experiments/030-app-lifecycle/window.py b/research/experiments/030-app-lifecycle/window.py index 3ec21a5..3c1d511 100755 --- a/research/experiments/030-app-lifecycle/window.py +++ b/research/experiments/030-app-lifecycle/window.py @@ -7,12 +7,16 @@ of apps, its store in RAM, the host on cores 0-2. A client on core 3 posts writes to it one after another on one connection; the time an app cannot answer is the longest gap between two answered writes (200) around the change. Changed: SIGHUP after its line names the other of two module files -(items.pmod, items-next.pmod: the same states, a view more), so each -reading starts it again on another module. Restarted: SIGTERM, then the -host started again (the client reconnecting at once). - -window.py PURE_SERVE ITEMS CHANGES RESTARTS a JSON line per change and per - restart, then one with medians +(items.pmod and NEXT, items-next.pmod unless named: the same states, a +view more; items-wide.pmod: its records a field more, so the list is laid +out anew), so each reading changes it to another module. Restarted: the +same change made the way there was before, the line naming the other +module, then SIGTERM and the host started again (the client reconnecting +at once). + +window.py PURE_SERVE ITEMS CHANGES RESTARTS [NEXT] a JSON line per change + and per restart, then one with + medians """ import http.client import json @@ -93,7 +97,7 @@ def free_port(): return probe.getsockname()[1] -def grow(port, items): +def grow(port, items, app='x'): connection = http.client.HTTPConnection('127.0.0.1', port, timeout=600) def post(path): @@ -102,10 +106,10 @@ def grow(port, items): answer.read() assert answer.status == 200, (path, answer.status) - post('/x/inputs/seed?n=1') + post(f'/{app}/inputs/seed?n=1') count = 1 while count < items: - post('/x/inputs/grow?step=1') + post(f'/{app}/inputs/grow?step=1') count *= 2 connection.close() return count @@ -113,10 +117,11 @@ def grow(port, items): def main(): serve, items, changes, restarts = Path(sys.argv[1]).resolve(), int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]) + after = sys.argv[5] if len(sys.argv) > 5 else 'items-next' work = Path(tempfile.mkdtemp(prefix='pure-030-', dir='/dev/shm')) try: modules = {} - for name in ('items', 'items-next'): + for name in ('items', after): modules[name] = work / f'{name}.pmod' subprocess.run([str(AUP), 'build', str(HERE / f'{name}.aup'), '-o', str(modules[name])], check=True) conf, store, port = work / 'apps.conf', work / 'store', free_port() @@ -132,17 +137,19 @@ def main(): time.sleep(0.5) gaps = {'changed': [], 'restarted': []} for n in range(changes): - write('items-next' if n % 2 == 0 else 'items') + write(after if n % 2 == 0 else 'items') since = time.monotonic() began = time.perf_counter() said = host.reading() took = time.perf_counter() - began - assert said['apps'][0]['did'] == 'restarted' and said['apps'][0]['running'], said + assert said['apps'][0]['did'] in ('restarted', 'changed') and said['apps'][0]['running'], said time.sleep(0.3) gaps['changed'].append(writer.gap(since)) - print(json.dumps({'items': count, 'way': 'changed', 'gap_ms': round(gaps['changed'][-1] * 1000, 2), + print(json.dumps({'items': count, 'way': 'changed', 'to': after if n % 2 == 0 else 'items', + 'did': said['apps'][0]['did'], 'gap_ms': round(gaps['changed'][-1] * 1000, 2), 'reading_ms': round(took * 1000, 2)}), flush=True) for n in range(restarts): + write(after if (changes + n) % 2 == 0 else 'items') since = time.monotonic() host.stop() host = Host(serve, conf, port) |
