github.com/vicanso/pike@v1.0.1-0.20210630235453-9099e041f6ec/docs/performance.md (about)

     1  ---
     2  description: 性能测试
     3  ---
     4  
     5  测试机器:8U 8GB内存
     6  测试数据:数据原始长度约为140KB
     7  测试场景:客户端支持gzip、 br以及不支持压缩三种场景,并发请求数设置为1000,测试时长为1分钟
     8  测试结论:当客户端可接受gzip或br压缩时,测试的结果均非常接近,而客户端不接受压缩时,需要先解压数据,性能则大幅度下降
     9  
    10  ## GZIP
    11  
    12  ```bash
    13  wrk -c1000 -t10 -d1m -H 'Accept-Encoding: gzip' --latency http://127.0.0.1:3015/repos
    14  Running 1m test @ http://127.0.0.1:3015/repos
    15    10 threads and 1000 connections
    16    Thread Stats   Avg      Stdev     Max   +/- Stdev
    17      Latency    17.12ms   17.05ms 241.93ms   83.49%
    18      Req/Sec     6.96k     1.17k   12.88k    73.49%
    19    Latency Distribution
    20       50%   16.78ms
    21       75%   29.72ms
    22       90%   38.34ms
    23       99%   66.55ms
    24    4153511 requests in 1.00m, 40.89GB read
    25  Requests/sec:  69123.45
    26  Transfer/sec:    696.85MB
    27  ```
    28  
    29  ## BR
    30  
    31  ```bash
    32  wrk -c1000 -t10 -d1m -H 'Accept-Encoding: br' --latency http://127.0.0.1:3015/repos
    33  Running 1m test @ http://127.0.0.1:3015/repos
    34    10 threads and 1000 connections
    35    Thread Stats   Avg      Stdev     Max   +/- Stdev
    36      Latency    16.65ms   16.27ms 181.87ms   64.06%
    37      Req/Sec     7.08k     1.06k   17.58k    70.18%
    38    Latency Distribution
    39       50%   16.56ms
    40       75%   29.11ms
    41       90%   37.47ms
    42       99%   62.46ms
    43    4223664 requests in 1.00m, 36.57GB read
    44  Requests/sec:  70302.18
    45  Transfer/sec:    623.26MB
    46  ```
    47  
    48  ## 不支持压缩
    49  
    50  ```bash
    51  wrk -c1000 -t10 -d1m  --latency http://127.0.0.1:3015/repos
    52  Running 1m test @ http://127.0.0.1:3015/repos
    53    10 threads and 1000 connections
    54    Thread Stats   Avg      Stdev     Max   +/- Stdev
    55      Latency   319.12ms  421.34ms   2.00s    81.56%
    56      Req/Sec   555.57    193.17     2.54k    69.97%
    57    Latency Distribution
    58       50%   32.36ms
    59       75%  589.84ms
    60       90%  965.91ms
    61       99%    1.61s
    62    331687 requests in 1.00m, 44.85GB read
    63    Socket errors: connect 0, read 0, write 0, timeout 4348
    64  Requests/sec:   5518.90
    65  Transfer/sec:    764.11MB
    66  ```