Boost: ASIO learning-HTTP server performance test report-column in kraussyin-blog channel-csdn. net
Boost: ASIO learning-HTTP server performance test report Category: boost Read by 773 Comment (0) Favorites Report
I carefully read the performance test items of ASIO today:Linux performance improvementsI tried it myself, but the test is not about the performance of different implementation mechanisms of ASIO itself (this is troublesome and requires downloading multiple implementation versions of ASIO ), I just tested the performance of the HTTP server of four different io_service models in ASIO example to see who is cool B.
Test Environment
For a Linux server, the CPU has four processors. The detailed configuration is as follows:
Linux 2.6.9-67. elsmp #1 SMP wed Nov 7 13:58:04 est 2007 i686 i686 i386 GNU/Linux Intel (r) Xeon (r) CPU e5430 @ 2.66 GHz
HTTP server io_service Model
Server 1: a simple single-threaded server. Single thread, single io_service
Server 2: io_service-per-CPU design. multithreading, multi-io_service, each thread processes an io_service, using the round-robin method to select io_service
Server 3: A single io_service and a thread pool. multithreading, single io_service, all threads run on the same io_service
Server 4: A single-threaded HTTP server implemented using stackless coroutines
Test Method
Run the server on 1, 2, 3, and 4 CPUs (processors) respectively)
Taskset-C 1./Server 127.0.0.1 55555/home/Zhongying
Taskset-C 55555./Server 127.0.0.1/home/Zhongying
Taskset-C 55555, 3./Server 127.0.0.1/home/Zhongying
Taskset-C 55555,./Server 127.0.0.1/home/Zhongying
Run AB on the same server for testing and send 100 concurrent connections to request 4 k Data
Taskset-C 0 AB-C 100-N 100000 'HTTP: // 127.0.0.1: 55555/test.txt'
Test Results
From the test results, we can see that the performance of the multi-threaded server2 and server3 is not much different, and server2 is a slight winner, I personally think that servers3 uses the strand mechanism to prevent multiple threads from executing a connection handler at the same time, which may slightly affect the performance.