Table of Contents
This detailed workload setup provides a comprehensive overview of the Kafka consumer environment on Linux, detailing how cloud events are handled, system resource configurations, and message publishing mechanisms.
Test Flow Description
According to requirements the test flow included following steps:
...
docker-compose --profile dmi-stub --profile monitoring up -d
...
This detailed workload setup provides a comprehensive overview of the Kafka consumer environment on Linux, detailing how cloud events are handled, system resource configurations, and message publishing mechanisms.
Test Flow Description
According to requirements the test flow included following steps:
Test Flow Steps:
Start Required Containers with Docker Compose:
- Navigate to the Docker Compose file:
C:\CPS\master\cps\docker-compose\docker-compose.yml
. - Use the following command to bring up all necessary containers:
Code Block language powershell theme Midnight docker-compose --profile dmi-stub --profile monitoring up -d
- Navigate to the Docker Compose file:
Stop the "cps-and-ncmp" Container:
- Manually stop the
cps-and-ncmp
container to simulate a controlled interruption in the service.
- Manually stop the
Publish CM AVC Cloud Events to Kafka:
- Use the K6 script located at
k6-tests\once-off-test\kafka\produce-avc-event.js
to publish Cloud Events to the Kafka topic "dmi-cm-events".
- Use the K6 script located at
Verify Published Messages in Kafka UI:
- Open Kafka UI at
http://localhost:8089/
.
- Open Kafka UI at
- Verify that the expected number of messages has been published to the "dmi-cm-events" topic.
Restart the "cps-and-ncmp"
...
Container:
- After the messages are published, restart the
cps-and-ncmp
container to resume normal operations.
- After the messages are published, restart the
Verify Message Consumption:
- Once the
cps-and-ncmp
container is running again, verify the number of messages consumed from the "cm-events" topic using Kafka UI athttp://localhost:8089/
- Once the
...
- .
Monitor System Metrics in Grafana:
- Log in to Grafana at
http://localhost:
- Log in to Grafana at
...
- Capture relevant metrics such as CPU, Memory, and Threads during the test execution.
...
K6 test load:
The flow was repeated in a loop multiple times (defined with
circles
parameter); Configuring a performance test scenario with a load-testing tool, possibly using something like k6 for generating load.Code Block language py title K6 Scenarios collapse true produce_cm_avc_event: { executor: 'shared-iterations', exec: 'produce_cm_avc_event', vus: 1000, // You can adjust VUs to meet performance requirements iterations: $TOTAL_MESSAGES, // Total messages to publish (for example: 100 K , 200 K) maxDuration: '15m', // Adjust depending on the expected completion time }
Test Environment
...
#
...
Environment/Workload
...
Description
...
Laptop : Dell Inc. XPS 15 9530
Processor : 13th Gen Intel® Core™ i9-13900H × 20
Installed RAM : 32.0 GiB
Edition : Fedora Linux 40 (Workstation Edition)u
...
Laptop : Lenovo ThinkPad
Processor : 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz 2.42 GHz
Installed RAM : 40.0 GB (39.7 GB usable)
Edition : Windows 11 Pro
...
1
...
dmi-cm-events
...
...
100,000 Kafka messages sent through the Kafka topic.
...
Cloud event headers
...
Explanation:
- executor: 'shared-iterations': The
shared-iterations
executor divides the total number of iterations among the virtual users (VUs). This is ideal if you know the total amount of work (in this case, messages) that you want to execute but not how long it will take. - exec: Refers to the function or scenario name that handles the actual work (in this case, generating CM AVC events).
- vus: The number of virtual users that will be running concurrently. You can adjust this based on how much load you want to simulate.
- iterations: The total number of iterations (or messages in your case) that the virtual users will complete. You can set this based on your performance test needs, e.g.,
100000
or200000
. - maxDuration: The maximum time the test is allowed to run. If the iterations are not completed within this time, the test will stop.
Suggested Adjustments:
- Make sure to replace
$TOTAL_MESSAGES
with a specific value, such as100000
or200000
, depending on your test requirements. - You may want to tune the
vus
andmaxDuration
depending on your system's capacity and how fast you expect the messages to be processed. If you're testing scalability, start with a smaller number and increase.
- executor: 'shared-iterations': The
Test Environment
# | Environment/Workload | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | Tested on Linux | Laptop : Dell Inc. XPS 15 9530 | |||||||||
2 | Tested on Windows | Laptop : Lenovo ThinkPad | |||||||||
2 | Number of CPS Instance | 1 | |||||||||
NCMP resource config | YAML Configuration: Defines deployment resources for the NCMP service: Replicas: 1 CPU Reservations: 2 CPUs Memory Reservations: 2 GB CPU Limits: 3 CPUs Memory Limits: 3 GB | ||||||||||
Kafka Topic configuration | CM Notification Topic Configuration: Enabled: false Group ID: cm_events Topic Name: dmi-cm-events | ||||||||||
Publishing topic name | dmi-cm-events | ||||||||||
Forwarded topic name | cm-events | ||||||||||
4 | Total number of Cm Avc cloud events | 100,000/200,000 Kafka messages sent through the Kafka topic. | |||||||||
5 | Cloud event headers | The headers for each Kafka message contain the following fields: ce_type: "org.onap.cps.ncmp.events.avc1_0_0.AvcEvent:1.0.0" ce_source: "DMI" ce_correlationid: Correlation destination: "dmi-cm-events" ce_specversion: "1.0" ce_time: ISO-formatted timestamp ce_id: A unique ID generated using crypto.randomUUID() | 6 | Kafka payload | Code Block | | |||||
language | js | title | SampleAvcInputEvent.jsonce_dataschema: "urn:cps.onap.cps.ncmp.events.avc1_0_0.AvcEvent:1.0.0"|||||||||
6 | Kafka payload |
| |||||||||
8 | Number of DMI Plugin stub | 1 DMI Plugin Stub is used for testing purposes. | |||||||||
9 | Commit ID | 81eb7dfc2f100a72692d2cbd7ce16540ee0a0fd4 | |||||||||
10 | Commit ID link | Commit Link | |||||||||
11 | K6 script (to publish cloud events) | The test script used to publish cloud events is located at: ..\cps\k6-tests\once-off-test\kafka\produce-avc-event.js |
Performance Comparison Between Linux and Windows Kafka Consumers:
...
Test Environment
...
Linux
...
Windows
...
Linux
...
Windows
...
Total number of kafka messages
100,000
...
200,000
...
CPU (%)
...
44.2
...
82.1
...
78.3
...
72.6
...
Memory (MB)
...
244
...
195
...
212
...
222
...
Total number of threads
...
321
...
320
...
320
...
319
...
1st kaka message forwarded (HH:MM:SS)
...
16:37:11
...
17:30:51
...
16.52.54
...
17.42.56
...
Last kaka message forwarded (HH:MM:SS)
...
16:37:14
...
17:31:03
...
16.52.59
...
17.43.10
...
Time taken to consume and forward kafka messages (Seconds)
...
3
...
12
...
5
...
14
...
Consumption rate (Messages / second)
...
33,333
...
8,333
...
40,000
...
14,286
Kafka Consumer Performance on Linux:
CPU Efficiency:
- Linux consumes 113.98% CPU, which is much lower compared to Windows (268.01%). For a Kafka consumer, this indicates that Linux efficiently handles Kafka message consumption with a lower CPU overhead. This is crucial in production environments where maximizing resource efficiency is key.
Memory Usage:
- 522 MB of memory is used by the Kafka consumer on Linux. While Linux consumes slightly more memory than Windows, this difference is not significant. The memory footprint appears stable and manageable, showing that Linux maintains Kafka consumption processes effectively.
Network Data:
- The Kafka consumer on Linux sends 59.6 MB of data and receives 113 MB of data, indicating a balanced network workload. Lower network data usage could imply efficient message batching or optimized data handling strategies, which are often critical in Kafka consumers for reducing latency and improving throughput.
Thread Management:
- The 360-361 threads on Linux suggest a stable and scalable multi-threading architecture for consuming Kafka messages. Since Kafka consumers can handle parallel processing of messages, this thread count shows Linux is performing within a controlled range without overloading the system with too many threads.
Message Consumption Rate:
- 33,333 messages per second on Linux is an exceptionally high consumption rate compared to Windows (16,667). This suggests that the Linux environment is highly optimized for Kafka consumers, allowing it to process a large volume of messages in real-time scenarios. This high throughput is vital in scenarios with large-scale data streams, where message backlogs need to be minimized.
Message Latency:
- The first Kafka message is forwarded at 13:49:25 and the last at 13:49:28, showing a minimal delay between the start and completion of message forwarding. This low latency is essential in Kafka-based systems that rely on quick, real-time message processing, and it demonstrates that Linux provides fast message handling.
Conclusion for Kafka Consumers on Linux:
- Efficient Resource Usage: Linux is shown to handle Kafka consumer tasks with efficient CPU usage and a stable memory footprint.
- Superior Throughput: The 33,333 messages/second throughput shows Linux can handle very high message ingestion rates, making it suitable for data-intensive Kafka streams.
- Low Latency: The minimal lag in forwarding Kafka messages indicates that Linux performs well under real-time processing demands.
- Optimized for Network and Threads: Balanced network data handling and stable thread management further highlight Linux’s ability to maintain performance under high workloads.
Overall, Linux is an excellent environment for running Kafka consumers, especially in scenarios that demand high throughput, low latency, and efficient resource management.
Key Observations:
- CPU Usage:
- Linux shows significantly lower CPU usage (113.98%) compared to Windows (268.01%), indicating that the process is more CPU-efficient on Linux.
- Memory Usage:
- Linux uses slightly more memory (522 MB) than Windows (497.3 MB), but the difference is minimal.
- Network Data:
- Linux sends less data (59.6 MB) than Windows (120 MB) but also receives less data (113 MB vs 168 MB). This could indicate different network handling efficiencies or workload patterns.
- Threads:
- The number of threads is almost identical between the two environments, so thread management is consistent.
- Kafka Message Timing:
- Linux processed Kafka messages earlier (13:49:25) than Windows (14:56:33). The processing duration is almost the same, but Linux starts earlier.
- Consumption Rate:
- Linux has a much higher message consumption rate (33,333 messages/second) than Windows (16,667 messages/second). This suggests that Linux is significantly more efficient in handling Kafka messages.
Conclusion:
- Linux demonstrates better performance overall in terms of CPU usage and message consumption rate. Despite similar memory usage, Linux handles Kafka message forwarding faster and consumes more messages per second.
- Windows consumes significantly more CPU resources and handles Kafka messages at a slower rate, making it less efficient for high-performance use cases.
...
| ||
8 | Number of DMI Plugin stub | 1 DMI Plugin Stub is used for testing purposes. |
9 | Commit ID | 81eb7dfc2f100a72692d2cbd7ce16540ee0a0fd4 |
10 | Commit ID link | Commit Link |
11 | K6 script (to publish cloud events) | The test script used to publish cloud events is located at: ..\cps\k6-tests\once-off-test\kafka\produce-avc-event.js |
This analysis compares the performance of two environments, Linux and Windows, when forwarding Kafka messages under different loads. The test captures metrics such as CPU usage, memory usage, thread count, and the time taken to forward Kafka messages. Here's the detailed breakdown of the data provided:
Metric | Linux | Windows | Linux | Windows |
Total number of kafka messages | 100,000 | 200,000 | ||
CPU Usage (%) | 44.2 | 82.1 | 78.3 | 72.6 |
Memory Usage (MB) | 244 | 195 | 212 | 222 |
Total Threads | 321 | 320 | 320 | 319 |
First Message Processed (HH:MM:SS) | 16:37:11 | 17:30:51 | 16.52.54 | 17.42.56 |
Last Message Processed (HH:MM:SS) | 16:37:14 | 17:31:03 | 16.52.59 | 17.43.10 |
Total Time to Process Messages (Seconds) | 3 | 12 | 5 | 14 |
Message Throughput (Messages/Second) | 33,333 | 8,333 | 40,000 | 14,286 |
Linux, 100,000 |
Linux, 200,000 |
Windows, 100,000 |
Windows, 200,000 |
Highlighted Points:
Total Number of Kafka Messages:
- Linux and Windows are tested with two sets of Kafka messages: 100,000 and 200,000 messages. This allows you to evaluate the system performance under both moderate and high loads.
CPU Usage:
- Linux (44.2% for 100K messages, 78.3% for 200K messages) shows significantly lower CPU usage than Windows (82.1% for 100K messages, 72.6% for 200K messages).
- Important: Windows CPU usage is very high at 100,000 messages (82.1%), indicating that the Windows environment is under heavy load. At 200,000 messages, the load decreases slightly (72.6%), likely due to optimization at higher loads.
Memory Usage:
- Linux uses 244 MB and 212 MB for 100,000 and 200,000 messages respectively, while Windows uses 195 MB and 222 MB.
- Important: Memory consumption is slightly lower on Linux for 200,000 messages compared to Windows.
Thread Count:
- The total number of threads used is relatively consistent across environments (around 320 threads).
Message Forwarding Times:
- The first and last Kafka messages were forwarded between 16:37:11 and 16:37:14 on Linux (for 100K messages), and between 17:30:51 and 17:31:03 on Windows.
- For 200,000 messages, Linux starts forwarding at 16:52:54 and ends at 16:52:59, whereas Windows starts at 17:42:56 and finishes at 17:43:10.
- Important: Linux consistently forwards messages faster, finishing in fewer seconds compared to Windows.
Time Taken to Forward Kafka Messages:
- For 100,000 messages:
- Linux forwards in 3 seconds, while Windows takes 12 seconds.
- For 200,000 messages:
- Linux forwards in 5 seconds, while Windows takes 14 seconds.
- Important: Linux is significantly faster than Windows at processing the Kafka messages.
- For 100,000 messages:
Consumption Rate (Messages/Second):
- For 100,000 messages, Linux processes at 33,333 messages/second, while Windows processes only 8,333 messages/second.
- For 200,000 messages, Linux processes at 40,000 messages/second, while Windows handles 14,286 messages/second.
- Important: Linux consistently handles Kafka messages at a higher rate, showing better throughput.
...
Verdict / Conclusion:
Linux Outperforms Windows:
- Message Processing Speed: Linux is able to process Kafka messages much faster than Windows. For both 100,000 and 200,000 messages, Linux takes significantly less time to forward messages, indicating better handling of high message throughput.
- Resource Utilization: Linux shows lower CPU and more stable memory usage compared to Windows, which indicates better scalability and efficiency under load.
- Consumption Rate: Linux achieves a far higher consumption rate (messages per second), which is crucial for performance in real-time systems handling Kafka messages.
Windows Bottlenecks:
- High CPU Utilization: Windows has a much higher CPU usage, especially under the 100,000 message load (82.1%), indicating that it might struggle under moderate to high loads.
- Lower Message Consumption Rate: The significantly lower message processing rate on Windows (8,333 vs. 33,333 messages/sec) suggests that Windows might not be the ideal environment for applications requiring high throughput.
Recommendation:
- For high-performance Kafka message processing, Linux is the superior environment. It is more efficient in terms of CPU, memory, and throughput.
- Windows may require optimization or be better suited for lighter workloads, but Linux provides a clear advantage for performance-intensive scenarios involving Kafka.