From 60eec85bb2901813fdc699396c059f3d485b73c7 Mon Sep 17 00:00:00 2001 From: ToineSiebelink Date: Tue, 29 Apr 2025 12:13:26 +0100 Subject: [PATCH] Increase CM Notification Event KPI Background Load - Update KPI script to send batches of messages - Increased KPI load from 500 to 2,500 events/sec using 10 VUs and batchsize of 250 - Added instrumentation on cm avc forwarding method - verified using Grafana (instrumentation) and kafka ui to confirm correct load of messages consumed and forwarded Issue-ID: CPS-2752 Change-Id: I90951bf7844e087b908082c2609d0f3a564d50f9 Signed-off-by: ToineSiebelink --- k6-tests/ncmp/common/produce-avc-event.js | 40 +++++++++++++++++-------------- k6-tests/ncmp/common/utils.js | 1 - k6-tests/ncmp/config/kpi.json | 6 ++--- k6-tests/ncmp/ncmp-test-runner.js | 4 ++-- k6-tests/ncmp/run-all-tests.sh | 2 +- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/k6-tests/ncmp/common/produce-avc-event.js b/k6-tests/ncmp/common/produce-avc-event.js index 220265c6e7..53ddb563b1 100644 --- a/k6-tests/ncmp/common/produce-avc-event.js +++ b/k6-tests/ncmp/common/produce-avc-event.js @@ -52,32 +52,36 @@ function getCloudEventHeaders() { }; } -export function sendKafkaMessages() { +export function sendBatchOfKafkaMessages(batchSize = 250) { + const messages = []; const cloudEventHeaders = getCloudEventHeaders(); const networkElementId = getRandomNetworkElement(); - const avcCloudEvent = { - key: schemaRegistry.serialize({ - data: networkElementId, - schemaType: SCHEMA_TYPE_STRING, - }), - value: schemaRegistry.serialize({ - data: testEventPayload, - schemaType: SCHEMA_TYPE_STRING - }), - headers: cloudEventHeaders - }; + for (let i = 0; i < batchSize; i++) { + const avcCloudEvent = { + key: schemaRegistry.serialize({ + data: networkElementId, + schemaType: SCHEMA_TYPE_STRING, + }), + value: schemaRegistry.serialize({ + data: testEventPayload, + schemaType: SCHEMA_TYPE_STRING + }), + headers: cloudEventHeaders + }; + messages.push(avcCloudEvent); + } try { - kafkaProducer.produce({messages: [avcCloudEvent]}); - messagesSent++; - const isMessageSent = check(kafkaProducer, { - 'Message sent successfully': (producer) => producer != null, + kafkaProducer.produce({messages: messages}); + messagesSent += messages.length; + const isBatchSent = check(kafkaProducer, { + ['Batch of ${batchSize} messages sent successfully']: (producer) => producer != null, }); - if (!isMessageSent) { - console.error('Failed to send message:', avcCloudEvent); + if (!isBatchSent) { + console.error('Failed to send batch of messages, batch size : ', batchSize); } } catch (error) { console.error(`Error during message production: ${error.message}`, avcCloudEvent); diff --git a/k6-tests/ncmp/common/utils.js b/k6-tests/ncmp/common/utils.js index 9406c1cd3e..49feeadfba 100644 --- a/k6-tests/ncmp/common/utils.js +++ b/k6-tests/ncmp/common/utils.js @@ -36,7 +36,6 @@ export const LEGACY_BATCH_THROUGHPUT_TEST_BATCH_SIZE = 200; export const LEGACY_BATCH_THROUGHPUT_TEST_NUMBER_OF_REQUESTS = 100; export const MODULE_SET_TAGS = ['tagA', 'tagB', 'tagC', 'tagD', 'tagE']; - /** * Generates a batch of CM-handle IDs based on batch size and number. * @param {number} batchSize - Size of each batch. diff --git a/k6-tests/ncmp/config/kpi.json b/k6-tests/ncmp/config/kpi.json index 0616fd876b..030c0f560d 100644 --- a/k6-tests/ncmp/config/kpi.json +++ b/k6-tests/ncmp/config/kpi.json @@ -130,11 +130,11 @@ }, "produceKafkaMessages": { "executor": "constant-arrival-rate", - "rate": 500, + "rate": 10, "timeUnit": "1s", "duration": "15m", - "preAllocatedVUs": 100, - "maxVUs": 300, + "preAllocatedVUs": 10, + "maxVUs": 12, "exec": "produceAvcEventsScenario", "gracefulStop": "10s" } diff --git a/k6-tests/ncmp/ncmp-test-runner.js b/k6-tests/ncmp/ncmp-test-runner.js index c6326f9916..4e44a47079 100644 --- a/k6-tests/ncmp/ncmp-test-runner.js +++ b/k6-tests/ncmp/ncmp-test-runner.js @@ -30,7 +30,7 @@ import { import { createCmHandles, deleteCmHandles, waitForAllCmHandlesToBeReady } from './common/cmhandle-crud.js'; import { executeCmHandleSearch, executeCmHandleIdSearch } from './common/search-base.js'; import { passthroughRead, passthroughWrite, legacyBatchRead } from './common/passthrough-crud.js'; -import { sendKafkaMessages } from './common/produce-avc-event.js'; +import { sendBatchOfKafkaMessages } from './common/produce-avc-event.js'; let cmHandlesCreatedPerSecondTrend = new Trend('cmhandles_created_per_second', false); let cmHandlesDeletedPerSecondTrend = new Trend('cmhandles_deleted_per_second', false); @@ -203,7 +203,7 @@ export function legacyBatchProduceScenario() { } export function produceAvcEventsScenario() { - sendKafkaMessages(); + sendBatchOfKafkaMessages(250); } export function legacyBatchConsumeScenario() { diff --git a/k6-tests/ncmp/run-all-tests.sh b/k6-tests/ncmp/run-all-tests.sh index 1b9332f834..2122a2555f 100755 --- a/k6-tests/ncmp/run-all-tests.sh +++ b/k6-tests/ncmp/run-all-tests.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2024 Nordix Foundation. +# Copyright 2024-2025 OpenInfra Foundation Europe. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. -- 2.16.6