- The device is a Dell server, the CPU is two Intel(R) Xeon(R) CPUs E5-2670 @ 2.60GHz, 16 cores and 32 threads;
- gcc version 7.3.0;
Test plan and results
We just want to test the performance of the drogon framework, so we want to simplify the controller’s processing as much as possible. We only do an HttpSimpleController and register it on the path. The controller returns for any request. Set the number of drogon threads to 16. The processing function is as follows and you can find the source code at the path:
For comparison, I chose nginx for comparison testing, wrote a , and compiled it with the nginx source. The nginx worker_processes parameter is set to 16.
We adjust the parameters of httpress, test each set of parameters five times, and record the maximum and minimum values of the number of requests processed per second. The test results are as follows:
As you can see, using the Keep-Alive option on the client side, drogon can process more than 500,000 requests per second in the case where a connection can send multiple requests. This score is quite good. In the case that each request initiates a connection, CPU time will be spent on TCP connection establishment and disconnection, and the throughput will drop to 140,000 requests per second, which is reasonable.
The image below is a screenshot of a test: