Background
We have seven load layers and use 5 physical machines with 24U+64G memory. Branch nginx does https encryption, decryption and proxy_pass. During commuting every day, the CPU of the five machines is basically around 50%, which is considered computing type.
Optimization methods: keepalive, TLS1.2 encryption algorithm optimization (reference: 1, 2), etc., but the effect is not great.
Let’s be particularly brief on the keepalive option. No matter how the server supports it, the key is that if the client doesn’t keep with you, you’re screwed.
Testing process
nginx -V:
version: openresty/1.9.7.3
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
–with-http_v2_module
Apache’s ab stress testing tool: yum installation
Picture:
Put the traffic diagram and you will understand:
The picture below shows when using ab and boom:
At this time, both ab and boom use -k. No matter how you play, the measurement and time are approximately at this level.
For example, the following command basically takes half an hour to run:
boom -c 1000 -n 1000000 -allow-insecure https://172.16.9.234/5k.jpg
ab -c 1000 -n 1000000 -khttps://172.16.9.234/5k.jpg
When the parameters are unchanged and converted to http2:
h2load -c 1000 -n 1000000 -m1 https://172.16.9.234/5k .jpg
h2load running results are as follows:
The following picture shows h2load when testing http2:
Gigabit network card, the outbound traffic is full.
Conclusion
The following conclusion has been tested repeatedly and represents only my own opinion. Please indicate from: toontong.
The above has introduced nginx's http20 performance which is incredible, HTTPS website performance optimization, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.