diff --git a/tools/energy-jmeter/README.md b/tools/energy-jmeter/README.md index 22d98c8..0fec431 100644 --- a/tools/energy-jmeter/README.md +++ b/tools/energy-jmeter/README.md @@ -319,3 +319,11 @@ JMeter writes request samples after their responses arrive. Missing future secon are not plotted as zeros. Report creation runs on the load generator. Verify aggregation with `python3 tools/energy-jmeter/verify-report.py`. + +For intentionally heavy shared-data capacity trials, use `review`, +`--allow-shared-read-account`, `--capacity-trial` and the desired thread count. +`--capacity-trial` restarts a read-only session after failures to maintain the trial +duration. Errors are still recorded and the run is marked unsuccessful if any occur; +the graphs remain useful for finding capacity. This mode permits no write scenarios. +First-use certificate pinning, when used instead of the installation CA, trusts the +certificate presented on that first connection; it is not an independently verified CA. diff --git a/tools/energy-jmeter/run.py b/tools/energy-jmeter/run.py index 5541eb4..0a710ef 100644 --- a/tools/energy-jmeter/run.py +++ b/tools/energy-jmeter/run.py @@ -16,11 +16,13 @@ p.add_argument('--session-pause-ms',type=int,default=120000) p.add_argument('--session-stddev-ms',type=int,default=30000);p.add_argument('--seed',type=int,default=42) p.add_argument('--output',required=True);p.add_argument('--jmeter',default=str(Path.home()/'.local/bin/jmeter')) p.add_argument('--allow-shared-read-account',action='store_true') +p.add_argument('--capacity-trial',action='store_true',help='Read-only trial: restart a session after an error so the configured duration is retained') p.add_argument('--perfmon-host');p.add_argument('--perfmon-port',type=int,default=4444) p.add_argument('--perfmon-interval-ms',type=int,default=1000);p.add_argument('--no-perfmon',action='store_true') p.add_argument('--shelly-host',default='192.168.1.44');p.add_argument('--shelly-port',type=int,default=80) p.add_argument('--shelly-switch-id',type=int,default=0);p.add_argument('--shelly-interval-ms',type=int,default=1000);p.add_argument('--no-shelly',action='store_true') a=p.parse_args() +if a.capacity_trial and a.scenario not in ['review','professional']:p.error('Capacity trial is restricted to read-only workloads') if a.users<1 or a.duration<1 or a.warmup<0 or a.ramp<0 or min(a.think_mean_ms,a.think_stddev_ms,a.session_pause_ms,a.session_stddev_ms)<0: p.error('Invalid timing/concurrency') if a.scenario!='idle' and not a.users_file: p.error('--users-file is required') if a.scenario!='idle' and not a.ca: p.error('--ca is required for application scenarios') @@ -71,6 +73,9 @@ plan=out/'runtime.jmx'; document=E.parse(source_plan) for collector in document.iter('kg.apc.jmeter.perfmon.PerfMonCollector'): collector.set('enabled','false' if a.no_perfmon else 'true') for group in document.iter('ThreadGroup'): + if a.capacity_trial and group.get('testname')=='Users': + for setting in group.findall('stringProp'): + if setting.get('name')=='ThreadGroup.on_sample_error':setting.text='startnextloop' if group.get('testname')=='Shelly live power':group.set('enabled','false' if a.no_shelly else 'true') document.write(plan,encoding='utf-8',xml_declaration=True) drain_seconds=max(5,a.shelly_interval_ms//1000+5) if not a.no_shelly else 5 @@ -79,6 +84,8 @@ cmd=[a.jmeter,'-n','-t',str(plan),'-l',str(out/'samples.csv'),'-j',str(out/'jmet metadata['jmeter_version']=subprocess.check_output([a.jmeter,'--version'],text=True).strip() cmd += ['-Jperfmon_host='+agent_host,'-Jperfmon_port='+str(a.perfmon_port),'-Jperfmon_file='+str(out/'perfmon.csv'),'-JjmeterPlugin.perfmon.interval='+str(a.perfmon_interval_ms),'-JjmeterPlugin.perfmon.useUDP=false'] cmd += ['-Jshelly_host='+a.shelly_host,'-Jshelly_port='+str(a.shelly_port),'-Jshelly_switch_id='+str(a.shelly_switch_id),'-Jshelly_interval_ms='+str(a.shelly_interval_ms),'-Jshelly_file='+str(out/'shelly.csv'),'-Jsample_variables='+','.join(shelly.VARIABLES)] +metadata['capacity_trial']=a.capacity_trial +metadata['error_policy']='restart session on error' if a.capacity_trial else 'stop user on error' metadata['shelly']={'enabled':not a.no_shelly,'host':a.shelly_host,'port':a.shelly_port,'switch_id':a.shelly_switch_id,'interval_ms':a.shelly_interval_ms,'device':shelly_info} metadata['perfmon']={'enabled':not a.no_perfmon,'host':agent_host,'port':a.perfmon_port,'interval_ms':a.perfmon_interval_ms} metadata['started_utc']=dt.datetime.now(dt.timezone.utc).isoformat(); started=time.monotonic()