# A Distributed Real-Time Monitoring Scheme for Air Pressure Stream Data Based on Kafka
## 4 Experimental Results and Analysis
### Throughput Comparison between Kafka and ActiveMQ  
We conducted an analysis and comparison of the performance of Kafka and ActiveMQ from the perspective of data throughput. We ran performance testing scripts for producers and consumers simultaneously on the same computer node to evaluate their relative throughput performance in the same environment. This approach simulated the scenario wherein producers and consumers work simultaneously in the practical system, which provides a better reflection of the overall performance of the scheme. In throughput testing, the number of messages transmitted per second (msg/s) is a key metric to measure the transmission rate. To evaluate the effective throughput of the messaging middleware, we adopted a standard method: measure the number of messages sent at 5 s intervals while the producer sends messages, which thus calculates the average message-sending rate per second. The throughput of consumers is also measured in the same manner. This method provides a more comprehensive and accurate assessment because it considers the average rate of message transmission rather than relying solely on instantaneous performance. Comparing the throughput of Kafka and ActiveMQ producers and consumers in this manner will help us better understand their performance differences in practice. Kafka provides developers with two performance testing scripts to evaluate the performance of producers and consumers in the system. The performance test script for producers aims to measure the message throughput transmitted per second through partitions; the performance test script for consumers measures the message throughput received per second from partitions. The ActiveMQ installation package does not contain performance test scripts like Kafka; therefore, we created producers and consumers by building a Maven project to measure the relative throughput of ActiveMQ. The relative throughput test results of Kafka and ActiveMQ (Figure 7) demonstrate that [PERSON] has a significant advantage in throughput. Specifically, [PERSON]'s producer average throughput reached 3,096,134 msg/s, which far surpassed ActiveMQ's 71,902 msg/s. Similarly, [PERSON]'s consumer average throughput was 3,090,558 msg/s, which is significantly higher than ActiveMQ's 72,500 msg/s. This comparison highlights [PERSON]'s efficiency and speed in message processing. However, we also observed a certain degree of fluctuation in [PERSON]'s performance data. The standard deviations for [PERSON]'s producer and consumer were 359,370 and 385,038, respectively. Conversely, ActiveMQ exhibited a more stable throughput, with standard \begin{table}
\begin{tabular}{c} \hline \hline \multicolumn{1}{c}{“ID”: “001”, “P”: 101.95, “SoC”: 77, “SI”: 30} \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Transfer data. Figure 7: Throughput comparison (Producer and Consumer). deviations of 4389 for the producer and 1695 for the consumer. Despite Kafka's superiority in throughput over ActiveMQ, ActiveMQ is more reliably stable. This can be explained by the following factors. Firstly, Kafka employs a batch-based transmission method that transmits and consumes multiple messages at once, whereas ActiveMQ uses a pipelined message queue approach to pull and consume individual messages sequentially. Secondly, considering scenarios where there may be numerous messages but consumers cannot process them, ActiveMQ provides a quality of service (QoS) limiting mechanism that effectively controls message transmission efficiency and avoids message blocking. For example, in test A, the average message transmission rate of the producer in the first stage was 81,431 msg/s, but it dropped to 66,010 msg/s in the next stage, which demonstrates that the QoS limiting mechanism reduced the producer's message transmission rate. Lastly, ActiveMQ ensures message delivery stability by acknowledging when a message is sent.