Increase CM Notification Event KPI Background Load 38/140838/1
authorToineSiebelink <toine.siebelink@est.tech>
Tue, 29 Apr 2025 11:13:26 +0000 (12:13 +0100)
committerToineSiebelink <toine.siebelink@est.tech>
Thu, 1 May 2025 17:04:11 +0000 (18:04 +0100)
- 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 <toine.siebelink@est.tech>
k6-tests/ncmp/common/produce-avc-event.js
k6-tests/ncmp/common/utils.js
k6-tests/ncmp/config/kpi.json
k6-tests/ncmp/ncmp-test-runner.js
k6-tests/ncmp/run-all-tests.sh

index 220265c..53ddb56 100644 (file)
@@ -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);
index 9406c1c..49feead 100644 (file)
@@ -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.
index 0616fd8..030c0f5 100644 (file)
     },
     "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"
     }
index c6326f9..4e44a47 100644 (file)
@@ -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() {
index 1b9332f..2122a25 100755 (executable)
@@ -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.