forked from mtusi2026/mtusi2026lab3
40 lines
1.8 KiB
Python
40 lines
1.8 KiB
Python
"""The case order used in the track 1 report, on one unchanged application image."""
|
|
import argparse
|
|
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument('phase', choices=['saturation', 'scaling', 'improvement'])
|
|
args = parser.parse_args()
|
|
runner = Path(__file__).with_name('scaling.py')
|
|
|
|
def run(name, replicas=4, cpu=1, memory='512m', concurrency=32, duration=15):
|
|
subprocess.run([sys.executable, str(runner), name, '--replicas', str(replicas),
|
|
'--cpu', str(cpu), '--memory', memory, '--concurrency', str(concurrency),
|
|
'--duration', str(duration)], check=True)
|
|
|
|
if args.phase == 'saturation':
|
|
for concurrency in [1, 4, 8, 16, 32, 64]:
|
|
run('saturation-c' + str(concurrency), concurrency=concurrency)
|
|
elif args.phase == 'scaling':
|
|
for repeat, order in enumerate([[1, 2, 4], [4, 2, 1], [2, 1, 4]], 1):
|
|
for replicas in order:
|
|
# Alternate which series runs first to reduce order bias.
|
|
for series in (['fixed', 'growing'] if repeat % 2 else ['growing', 'fixed']):
|
|
run(f'{series}-n{replicas}-r{repeat}', replicas=replicas,
|
|
cpu=2/replicas if series == 'fixed' else 1,
|
|
memory=f'{1024//replicas}m' if series == 'fixed' else '512m', concurrency=8)
|
|
else:
|
|
for repeat, order in enumerate([['before', 'after'], ['after', 'before'], ['before', 'after']], 1):
|
|
for version in order:
|
|
replicas = 4 if version == 'before' else 2
|
|
run(f'improvement-{version}-r{repeat}', replicas=replicas,
|
|
cpu=2/replicas, memory=f'{1024//replicas}m', concurrency=8, duration=45)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|