[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}`;
}