Simple performance test of snaic and tornado

Operating system: centos7.3.1611

Python version: 3.6.8

tornado version: 6.0.2

snaic version: 19.9.0

CPU: Intel(R) Core(TM) i5-2320 CPU @ 3.00GHz 4-core

tornado has been used as the framework of http related python programs before. Recently, it was found that the performance of the new snaic is very high. Here, under the same hardware conditions, ab is used for simple pressure testing.

Preparation

To install the apache ab tool:

yum -y install httpd-tools

Pressure test command:

ab -c 30 -n 100000 http://127.0.0.1:9093/

Parameter Description:

-c: simulate concurrent number

-n: total requests

Contrast test

Simple http server code implemented with tornado: https://github.com/mike-zhang/pyExamples/blob/master/httpRelate/httpServer/tornadoTest1.py

Simple http server code implemented with snaic: https://github.com/mike-zhang/pyExamples/blob/master/httpRelate/httpServer/snaicTest1.py

tornado test results:

Server Software:        TornadoServer/6.0.2
Server Hostname:        127.0.0.1
Server Port:            9093

Document Path:          /
Document Length:        12 bytes

Concurrency Level:      30
Time taken for tests:   82.282 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      20700000 bytes
HTML transferred:       1200000 bytes
Requests per second:    1215.33 [#/sec] (mean)
Time per request:       24.685 [ms] (mean)
Time per request:       0.823 [ms] (mean, across all concurrent requests)
Transfer rate:          245.68 [Kbytes/sec] received

Connection Times (ms)
                          min  mean[+/-sd] median   max
Connect:        0    0   0.2      0       8
Processing:     1   25  10.3     25      74
Waiting:        1   24  10.3     25      74
Total:          1   25  10.3     25      74

Percentage of the requests served within a certain time (ms)
  50%     25
  66%     30
  75%     33
  80%     34
  90%     37
  95%     39
  98%     41
  99%     42
 100%     74 (longest request)

snaic test results:

Server Software:
Server Hostname:        127.0.0.1
Server Port:            9093

Document Path:          /
Document Length:        12 bytes

Concurrency Level:      30
Time taken for tests:   20.164 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      11100000 bytes
HTML transferred:       1200000 bytes
Requests per second:    4959.29 [#/sec] (mean)
Time per request:       6.049 [ms] (mean)
Time per request:       0.202 [ms] (mean, across all concurrent requests)
Transfer rate:          537.58 [Kbytes/sec] received

Connection Times (ms)
                          min  mean[+/-sd] median   max
Connect:        0    2   0.5      2      11
Processing:     1    4   1.5      4      38
Waiting:        0    4   1.4      3      37
Total:          1    6   1.5      6      41

Percentage of the requests served within a certain time (ms)
  50%      6
  66%      6
  75%      7
  80%      7
  90%      7
  95%      8
  98%      9
  99%     10
 100%     41 (longest request)

From the test results, we can see that when two processes are started:

The cps of tornado is 1215.33, and the average response time is 24.685 ms

The cps of snaic is 4959.29 and the average response time is 6.049 ms

The test data after modifying the concurrent number is as follows:

 

The test results are compared as follows:

 

From the test data, snaic has higher cps than tornado, and shorter average response time than tornado.

github address:

Https://github.com/mike-zhang/mikeblogessays/blob/master/2019/20191102 simple performance test for snaic and tornado.rst

Welcome to add

Tags: Python github Apache yum

Posted on Sat, 02 Nov 2019 14:06:29 -0400 by Jaxeed