
Figure 1.
Reactor model based web server

Figure 2.
Reactor model based web server

Figure 3.
Reactor Modules

Figure 4.
Reactor Modules

Figure 5.
Event Driven Modules

Figure 6.
Event-Driven Class

Figure 7.
Epoll Class

Figure 8.
Event Class

Figure 9.
Server Module

Figure 10.
Server Class

Figure 11.
Flowchart of The New-Connection Function

Figure 12.
Epoll Class

Figure 13.
Socket Class

Figure 14.
Acceptor Class

Figure 15.
Connection Class

Figure 16.
Flowchart of the handle-ReadEvent

Figure 17.
ThreadPool Class

Figure 18.
Using of Webbench
TABLE I.
Explanation of Webbench Usage Options
| Webbench Usage Parameters | Parameter explanation |
|---|---|
| ./webbench | Starts the Webbench testing tool. |
| -c | Specify the number of concurrent clients |
| -t | Specify the duration of HTTP requests |
| http://127.0.0.1:2000/ | accesses the specified web server |

Figure 19.
Webbench Test Result Chart

Figure 20.
Single Reactor Single Thread Web Server Test Results
TABLE III.
Scope of Testing for Single Reactor Multithreading Web Server
| Variable | Test Range |
|---|---|
| Number of threads | 1-30 |
| Transaction processing time (us) | 0-1000 |

Figure 21.
Test Results of Single Reactor Multi thread Web Server
TABLE IV.
Multi-Reactor Multi-threading Test Scope under 200us
| Variable | Test range |
|---|---|
| Operational processing time (us) | 0-1000 |

Figure 22.
Test Results of Single Reactor Multi thread Web Server

Figure 23.
Cross-section at 200us

Figure 24.
Comparison Chart of QPS for Different Time periods

Figure 25.
Final Test Results
TABLE V.
Scope of Testing for Single Reactor Multi
| Model | Advantages | Disadvantages |
|---|---|---|
| Single-Reactor Single Threading | Simple to implement, easy to program and debug; suitable for low concurrency and lightweight business processing scenarios | Poor performance in high concurrency and long time business processing, easy to single thread blocking caused by other requests are delayed processing |
| Single-Reactor Multi-Threading | The introduction of a thread pooling mechanism serves to enhance the concurrent processing capacity, circumventing the issue of single-thread blocking. This approach is particularly effective in scenarios involving medium concurrency and medium business processing times, offering optimal performance. | The use of multiple threads in a single program can lead to data contention and synchronization problems, necessitating the implementation of locking mechanisms. This, in turn, can result in increased programming complexity and resource overhead. Furthermore, the overhead associated with thread switching may contribute to performance bottlenecks in highly concurrent environments. |
| Multi-Reactor Multi-Threading | The concurrent processing capability is significantly enhanced by dividing the work among multiple reactors. Each reactor operates independently, reducing competition for resources and improving overall performance. It demonstrates robust performance in high concurrency and longterm business processing. | The complexity of the programming and maintenance processes, coupled with the necessity of dealing with multiple reactor and thread synchronization, gives rise to a considerable challenge in terms of resource management. In order to circumvent performance bottlenecks, it is essential to configure the reactor and thread pool in a reasonable manner. |