We've implemented the support of SO_REUSEPORT [1] in Tengine. To see the performance improvement, we did a very simple benchmark with four Linux boxes. Three boxes were employed as clients, and the other one as a web server with Tengine listening on port 81 and Nginx listening on port 82. All the hardware specifications of the boxes were the same.
We ran three test cases with concurrency from 100 to 1000. The test cases were:
Tengine with SO_REUSEPORT enabled (reuse_port on).
Nginx with accept lock (accept_mutex on).
Nginx without accept lock (accept_mutex off).
The benchmark software we used was ApacheBench. Here's a command line example:
As you can see, the configuration files of Tengine and Nginx are generally the same except the 'reuse_port', 'worker_cpu_affinity', and 'accept_mutex' directives. Also note that it is more convenient to set CPU affinity in Tengine as it supports 'worker_cpu_affinity auto'.
Conclusion
Tengine had a performance improvement of 200% compared to Nginx with accept lock, which is the default setting.
Tengine had a performance improvement of 60% compared to Nginx without accept lock.