# Migrating from Developing Asynchronous Multi-Threading Programs to Reactive Programs in Java
## 7 Evaluation of Results
### Performance Analysis
#### 7.2.2 Evaluation Under Concurrent Load Conditions  
Analyzing the performance of the two approaches under concurrent conditions involved both the selection of appropriate tools for simulating and monitoring the traffic with a variable number of users and the definition of a test plan that would provide relevant data and a fair evaluation, minimizing errors and avoiding sudden overload. The simulation of concurrency with varying numbers of users was performed using Apache JMeter [65]. The testing started with a 60-s ramp-up period per scenario, during which the number of requests was gradually increased. The actual tests were run over 3 min durations with the ramp-up period data deliberately excluded from the reports as the focus was on monitoring and analyzing the performance of both systems after reaching a stable state at the desired level of concurrency. The metrics were collected using the aggregated reports generated by JMeter, which captured a detailed overview of the response times and throughput rates, but also using VisualVM, which allowed for the monitoring and recording of resources such as memory consumption and CPU usage, together offering insights into the system's performance under high concurrency and the ability to handle an increasing number of requests over time, ensuring a solid evaluation of both efficiency and scalability. The first analyzed scenario implied the fetching of a user profile summary. A list of user IDs extracted from the database was loaded into the test plan defined with JMeter, and virtual users launched concurrent requests using distinct IDs. The plots illustrating the heap memory and throughput variation are displayed in Figure 5.  
At a low concurrency level of 10 users, the reactive model consumed 60 MB of memory, while the asynchronous model consumed 64 MB. CPU usage was 5.2% for the reactive model and 5.9% for the asynchronous model. The average response time was 8 ms for the reactive model and 9 ms for the asynchronous model. The 90 th percentile response time was 9 ms for the reactive model and 11 ms for the asynchronous model. Throughput was measured at 1015 req/s for the reactive model and 936 req/s for the asynchronous model. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Microservice (Paradigm)** &
\begin{tabular}{c} **Heap Memory** \\ **Consumption (MB)** \\ \end{tabular} & **Startup Time (ms)** & **JAR Size (MB)** \\ \hline User Service (async) & 61 & 2363 & 52 \\ User Service (reactive) & 38 & 1522 & 37 \\ Tweet Service (async) & 62 & 2921 & 61 \\ Tweet Service (reactive) & 45 & 1874 & 45 \\ Interaction Service (async) & 70 & 3526 & 61 \\ Interaction Service (reactive) & 51 & 2107 & 41 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Static and initialization metrics. Figure 5: Performance results for fetching user profile summaries. At a mid-concurrency level of 500 users, the reactive model consumed 260 MB of memory, while the asynchronous model consumed 335 MB. CPU usage was 37.3% for the reactive model and 34.2% for the asynchronous model. The average response time was 51 ms for the reactive model and 69 ms for the asynchronous model. The 90 th percentile response time was 61 ms for the reactive model and 141 ms for the asynchronous model. Throughput was measured at 8075 req/s for the reactive model and 6008 req/s for the asynchronous model. At a peak concurrency level of 1000 users, the reactive model consumed 473 MB of memory, while the asynchronous model consumed 535 MB. CPU usage was 42.1% for the reactive model and 40.7% for the asynchronous model. The average response time was 93 ms for the reactive model and 125 ms for the asynchronous model. The 90 th percentile response time was 121 ms for the reactive model and 277 ms for the asynchronous model. Throughput was measured at 8867 req/s for the reactive model and 6659 req/s for the asynchronous model. The second investigated scenario involved simulating user interactions within the application, specifically the action of subscribing to other users.