Test tool: ab (apacheBench)
Hardware environment:
Intel xeon cpu E5-2682 v4 2.50GHz 4 core
8GBytes memory
Software environment:
ubuntu16
nginx
Static file
3Kbytes
26000 responses/second (average)
Throughput: 111Mbytes/second (average)
Number of concurrencies: 300
Response time per request: 10.8 [ms] (average)
---------- -----------------------------------------------
58Kbytes
20000 times Response/second (average)
Throughput: 1165Mbytes/second (average)
Concurrency: 300
Response time per request: 14.2 [ms] (average)
-------------------------------------------------- -----
beego
Dynamic files
3Kbytes
16000 responses/second (average)
Throughput: 52Mbytes/second (average Value)
Number of concurrency: 330
Response time for each request: 20.2[ms] (average)
Performance test result analysis:
As can be seen from the above results, nginx has a negative impact on static The file processing performance is very powerful in terms of throughput, concurrency, and unit request processing time. And the cpu usage is only 50%. The entire performance is limited by the ab single process and is not fully utilized.
Beego’s dynamic file processing performance is also very powerful. When the same file (3Kbytes) is processed by nginx as a static file, the performance is 2.6W responses per second. When beego is used as a dynamic file processing, it can still achieve a performance of 16,000 responses per second, with a small performance drop. Compared with static file processing, the dynamic file processing server needs to go through more processes to complete the output, so performance will decrease.
When beego was processing, the server cpu usage reached 95%, and when tested on a laptop before, the i3 cpu usage also reached 93%, indicating that beego has good scalability. With the strengthening of hardware (CPU, memory), stronger performance can be achieved.
The above is the detailed content of Introducing beego and nginx performance test examples. For more information, please follow other related articles on the PHP Chinese website!