Nginx can be used as an HTTP server and reverse proxy server. The reverse proxy server depends on the performance of the backend server. This time, it only tests the performance of the HTTP server. As a server, nginx is dependent on the network performance, especially the PPS forwarding capability. Therefore, network-enhanced instances must be the first choice.
With 10G network bandwidth, we recommend that you use the following ECs instance type families. sn1ne (nginx has low memory requirements and does not require ECs instances of the specification family. sn2ne); in 25G network bandwidth, the recommended instance type family is C5.
Test Verification Test Method
- Operating System: centos 7.3 (irqbalance is enabled by default)
- Testing Software: nginx 1.12.1
- Stress Testing Tool: apache2132.3
Test Object
- ECS. sn1ne. 4 xlarge 16C/32 GB
- ECS. sn1ne. 8 xlarge 32C/64 GB
Test Architecture
Pressure Test command
32 concurrent command: AB-N 100000000-C 10-K http: // $ {server_ip }/
Parameter Adjustment
System Parameter Adjustment
Open multiple queues.
Enable RPS.
After testing, it is found that when the 16-core feature is not enabled, all CPUs can be fully occupied and the network reaches the limit. However, when testing the 32-core feature, the RPS needs to be enabled.
Modify the number of opened files.
Nginx parameter adjustment.
Open a multi-process. Nginx is a single work process by default.
You can configure the following in the nginx. conf file:
Worker_processes 32;
Worker_cpu_affinity auto;
Increase the number of connections: Configure worker_connections 102400.
Test conclusion
Sn1ne. 4 xlarge has a PPS of up to 150 W, and the pressure test QPS reaches 140 W. At this time, all CPU usage is close to 100%. (The QPS is measured by Tsar .)
The maximum PPS of sn2ne. 8 xlarge is 250 W, and the pressure test QPS reaches 210 w. At this time, all CPU usage is close to 100%.
Nginx stress test