[k6] Measure NCMP overhead for passthrough operations
Measure NCMP overhead by subtracting DMI delay from request duration.
Issue-ID: CPS-2269
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: Ieb4758e9f7cab119da4c28e4a3febfa1361b2613
diff --git a/k6-tests/ncmp/common/utils.js b/k6-tests/ncmp/common/utils.js
index 4bf066c..0f3b8d9 100644
--- a/k6-tests/ncmp/common/utils.js
+++ b/k6-tests/ncmp/common/utils.js
@@ -22,6 +22,8 @@
export const DMI_PLUGIN_URL = 'http://ncmp-dmi-plugin-demo-and-csit-stub:8092';
export const TOTAL_CM_HANDLES = 20000;
export const REGISTRATION_BATCH_SIZE = 100;
+export const READ_DATA_FOR_CM_HANDLE_DELAY_MS = 300; // must have same value as in docker-compose.yml
+export const WRITE_DATA_FOR_CM_HANDLE_DELAY_MS = 670; // must have same value as in docker-compose.yml
export const CONTENT_TYPE_JSON_PARAM = { headers: {'Content-Type': 'application/json'} };
export function recordTimeInSeconds(functionToExecute) {
@@ -53,14 +55,18 @@
}
export function makeCustomSummaryReport(data, options) {
- let summaryCsv = '#,Test Name,Unit,Limit,Actual\n';
- summaryCsv += makeSummaryCsvLine(1, 'Registration of CM-handles', 'CM-handles/second', 'cmhandles_created_per_second', data, options);
- summaryCsv += makeSummaryCsvLine(2, 'De-registration of CM-handles', 'CM-handles/second', 'cmhandles_deleted_per_second', data, options);
- summaryCsv += makeSummaryCsvLine(3, 'CM-handle ID search with Module filter', 'milliseconds', 'http_req_duration{scenario:id_search_module}', data, options);
- summaryCsv += makeSummaryCsvLine(4, 'CM-handle search with Module filter', 'milliseconds', 'http_req_duration{scenario:cm_search_module}', data, options);
- summaryCsv += makeSummaryCsvLine(5, 'Synchronous single CM-handle pass-through read', 'requests/second', 'http_reqs{scenario:passthrough_read}', data, options);
- summaryCsv += makeSummaryCsvLine(6, 'Synchronous single CM-handle pass-through write', 'requests/second', 'http_reqs{scenario:passthrough_write}', data, options);
- return summaryCsv;
+ const summaryCsvLines = [
+ '#,Test Name,Unit,Limit,Actual',
+ makeSummaryCsvLine('1', 'Registration of CM-handles', 'CM-handles/second', 'cmhandles_created_per_second', data, options),
+ makeSummaryCsvLine('2', 'De-registration of CM-handles', 'CM-handles/second', 'cmhandles_deleted_per_second', data, options),
+ makeSummaryCsvLine('3', 'CM-handle ID search with Module filter', 'milliseconds', 'http_req_duration{scenario:id_search_module}', data, options),
+ makeSummaryCsvLine('4', 'CM-handle search with Module filter', 'milliseconds', 'http_req_duration{scenario:cm_search_module}', data, options),
+ makeSummaryCsvLine('5a', 'Synchronous single CM-handle pass-through read', 'requests/second', 'http_reqs{scenario:passthrough_read}', data, options),
+ makeSummaryCsvLine('5b', 'NCMP overhead for Synchronous single CM-handle pass-through read', 'milliseconds', 'ncmp_overhead_passthrough_read', data, options),
+ makeSummaryCsvLine('6a', 'Synchronous single CM-handle pass-through write', 'requests/second', 'http_reqs{scenario:passthrough_write}', data, options),
+ makeSummaryCsvLine('6b', 'NCMP overhead for Synchronous single CM-handle pass-through write', 'milliseconds', 'ncmp_overhead_passthrough_write', data, options),
+ ];
+ return summaryCsvLines.join('\n') + '\n';
}
function makeSummaryCsvLine(testCase, testName, unit, thresholdInK6, data, options) {
@@ -68,5 +74,5 @@
const thresholdString = thresholdArray[0];
const [thresholdKey, thresholdOperator, thresholdValue] = thresholdString.split(/\s+/);
const actualValue = data.metrics[thresholdInK6].values[thresholdKey].toFixed(3);
- return `${testCase},${testName},${unit},${thresholdValue},${actualValue}\n`;
+ return `${testCase},${testName},${unit},${thresholdValue},${actualValue}`;
}
diff --git a/k6-tests/ncmp/ncmp-kpi.js b/k6-tests/ncmp/ncmp-kpi.js
index 6bf0568..96c6263 100644
--- a/k6-tests/ncmp/ncmp-kpi.js
+++ b/k6-tests/ncmp/ncmp-kpi.js
@@ -19,14 +19,17 @@
*/
import { check } from 'k6';
-import { Gauge } from 'k6/metrics';
-import { TOTAL_CM_HANDLES, makeCustomSummaryReport, recordTimeInSeconds } from './common/utils.js';
+import { Gauge, Trend } from 'k6/metrics';
+import { TOTAL_CM_HANDLES, READ_DATA_FOR_CM_HANDLE_DELAY_MS, WRITE_DATA_FOR_CM_HANDLE_DELAY_MS,
+ makeCustomSummaryReport, recordTimeInSeconds } from './common/utils.js';
import { registerAllCmHandles, deregisterAllCmHandles } from './common/cmhandle-crud.js';
import { executeCmHandleSearch, executeCmHandleIdSearch } from './common/search-base.js';
import { passthroughRead, passthroughWrite } from './common/passthrough-crud.js';
let cmHandlesCreatedPerSecondGauge = new Gauge('cmhandles_created_per_second');
let cmHandlesDeletedPerSecondGauge = new Gauge('cmhandles_deleted_per_second');
+let passthroughReadNcmpOverheadTrend = new Trend('ncmp_overhead_passthrough_read');
+let passthroughWriteNcmpOverheadTrend = new Trend('ncmp_overhead_passthrough_write');
const DURATION = '15m';
@@ -64,10 +67,14 @@
'cmhandles_deleted_per_second': ['value >= 22'],
'http_reqs{scenario:passthrough_write}': ['rate >= 13'],
'http_reqs{scenario:passthrough_read}': ['rate >= 25'],
- 'http_req_failed{scenario:id_search_module}': ['rate == 0'],
- 'http_req_failed{scenario:cm_search_module}': ['rate == 0'],
+ 'ncmp_overhead_passthrough_read': ['avg <= 100'],
+ 'ncmp_overhead_passthrough_write': ['avg <= 100'],
'http_req_duration{scenario:id_search_module}': ['avg <= 625'],
'http_req_duration{scenario:cm_search_module}': ['avg <= 13000'],
+ 'http_req_failed{scenario:id_search_module}': ['rate == 0'],
+ 'http_req_failed{scenario:cm_search_module}': ['rate == 0'],
+ 'http_req_failed{scenario:passthrough_read}': ['rate == 0'],
+ 'http_req_failed{scenario:passthrough_write}': ['rate == 0'],
},
};
@@ -84,11 +91,15 @@
export function passthrough_read() {
const response = passthroughRead();
check(response, { 'passthrough read status equals 200': (r) => r.status === 200 });
+ const overhead = response.timings.duration - READ_DATA_FOR_CM_HANDLE_DELAY_MS;
+ passthroughReadNcmpOverheadTrend.add(overhead);
}
export function passthrough_write() {
const response = passthroughWrite();
check(response, { 'passthrough write status equals 200': (r) => r.status === 200 });
+ const overhead = response.timings.duration - WRITE_DATA_FOR_CM_HANDLE_DELAY_MS;
+ passthroughWriteNcmpOverheadTrend.add(overhead);
}
export function id_search_module() {