# Migrating from Developing Asynchronous Multi-Threading Programs to Reactive Programs in Java
## 4 Current State of Technology
### Performance and Cost Analysis  
When developing reactive applications, one important aspect is the appropriate selection of tools for the application's specific requirements. RJava and Project Reactor are two of the most popular libraries currently available, offering a considerable number of built-in features that allow for improved concurrency, scalability, and performance [5]. Some benchmarks have been undertaken and will be analyzed further to provide relevant information on their performance and costs.  
In terms of individual reactive operations, RJava outperformed Project Reactor, proving to be the superior choice for reactive processing in the conducted benchmarks, which covered scenarios such as transforming and selecting values, chaining individual operations, and applying multiple composed operations [43]. This is important because asynchronous individual operations are frequently used in situations such as database insert requests or message acknowledgment. The results are reported in Table 2.  
In terms of event stream processing, Project Reactor performed better than RJava, displaying an overall improvement in processing time and the ability to handle a larger number of events. This is equally important, as event streams are widely used in modern applications, especially in real-time data processing platforms such as streaming services or IoT devices. Results are available in Table 3.  
For I/O-bound operations, both RJava and Project Reactor performed similarly in terms of processing time. However, Project Reactor had a slight advantage in terms of resource consumption, utilizing less memory and CPU compared to RJava. The efficient management of I/O-bound operations is also a relevant topic, as these operations are frequently encountered for accessing data from external resources such as databases, file systems, or network services.  
The results of these benchmarks indicate that there is no universally optimal solution for all programming tasks, with both RJava and Project Reactor demonstrating effectiveness in different scenarios. In scenarios involving individual operations, RJava proved to be superior, whereas Project Reactor is better suited for managing operations with event streams. So, each framework has its own unique strengths, making them both valuable depending on the application's specific requirements. For I/O-bound operations, both libraries performed similarly, with Project Reactor showing a slight advantage in terms of resource consumption. When deciding on migrating to reactive programming, it is important to consider the specific requirements and constraints of the application and choose the library that best meets them. The cost of migration can be high, but the long-term benefits  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Operation Type** & **RJava (ops/ms)** & **Reactor (ops/ms)** & **Base (ops/ms)** \\ \hline Map & 33,000 & 10,000 & 63,000 \\ Chain & 23,000 & 13,000 & 63,000 \\ Multiple operators & 12,000 & 5000 & 28,000 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Throughput for individual operations [43].  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Operation Type** & **RJava (ops/ms)** & **Reactor (ops/ms)** & **Base (ops/ms)** \\ \hline Map & 240 & 250 & - \\ ManyToMany & 130 & 140 & - \\ Filters & 130 & 150 & - \\ \hline Multiple operators & 100 & 100 & 120 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Throughput for event streams [43].  
of improved scalability, resilience, and resource efficiency can compensate for these costs in many situations, such as real-time data processing or handling large amounts of data. Ultimately, the decision of whether to migrate should be based on a detailed analysis of the performance and cost benefits that can be achieved for each business use case.