The thread pool and the I/O multiplexing technology can effectively reduce the consumption of resources and enhance the concurrency of a server, which improves the capability of the system. Architects tend to use multiple threads to improve system concurrency, which has been proved to be effective in the past few years. However, the cost of creating, switching, and destroying threads remains to be an assignable problem when the system is having a concurrent peak. This paper designs and implements a server based on the technologies of the thread pool and epoll to figure out if the mixture of epoll and thread pool as optimization can help decrease thread operation costs. To deal with the system overhead, we introduce the thread pool technology based on an epoll web server to avoid the cost of frequent operations of creating or destroying threads. We build two sets of experiments to verify the effectiveness of our optimization, including a web server with thread pool and epoll as the experimental group, and a simple epoll web server without thread pool as the control group. Then, we test the system performance by altering the concurrency of each experimental and measuring the actual-time system overhead to describe the improvement we made to the multi-threaded server. The results show that the concurrent server with the technology of epoll and thread pool can achieve high performance and high concurrency.
|