springcloud与dubbo的性能对比

长期使用dubbo的团队中推行springcloud确实是个难题,巨大理由之一就是rpc调用效率远远高于http,故此做一个相关性能测试,所用到的dubbo与spring系均采用官方最新版(dubbo 2.5.7 、springboot 1.5.9 、springcloud edgware)。

springcloud测试代码地址 https://github.com/liuchengts/spring-cloud-ts.git

dubbo测试代码地址 https://github.com/liuchengts/dubbo-ts.git

测试思路:使用ab工具执行10000个请求并发量为100,多次测试,取最高与最低值计算平均值
测试对象:

       1、dubbo请求:http://192.168.10.138:8082/

   2、cloud直接请求:http://192.168.10.138:3002/

   3、cloudzuul路由请求:http://192.168.10.138:3000/test-comsumer/
测试过程:
  dubbo:
最高性能时期:

AppledeMacBook-Pro:~ apple$ ab -n 10000 -c 100 http://192.168.10.138:8082/

This is ApacheBench, Version 2.3 <$Revision: 1796539 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/


Benchmarking 192.168.10.138 (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests



Server Software:        

Server Hostname:        192.168.10.138

Server Port:            8082


Document Path:          /

Document Length:        11 bytes


Concurrency Level:      100

Time taken for tests:   2.881 seconds

Complete requests:      10000

Failed requests:        0

Total transferred:      1850000 bytes

HTML transferred:       110000 bytes

Requests per second:    3470.94 [#/sec] (mean)

Time per request:       28.811 [ms] (mean)

Time per request:       0.288 [ms] (mean, across all concurrent requests)

Transfer rate:          627.07 [Kbytes/sec] received


Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        3   12   5.5     11      57

Processing:     7   16   6.1     15      63

Waiting:        7   16   6.0     14      63

Total:         16   28   9.4     26     102


Percentage of the requests served within a certain time (ms)

  50%     26

  66%     28

  75%     30

  80%     31

  90%     36

  95%     44

  98%     65

  99%     70

 100%    102 (longest request)

最低性能时期:

AppledeMacBook-Pro:~ apple$ ab -n 10000 -c 100 http://192.168.10.138:8082/

This is ApacheBench, Version 2.3 <$Revision: 1796539 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/


Benchmarking 192.168.10.138 (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests



Server Software:        

Server Hostname:        192.168.10.138

Server Port:            8082


Document Path:          /

Document Length:        11 bytes


Concurrency Level:      100

Time taken for tests:   3.064 seconds

Complete requests:      10000

Failed requests:        0

Total transferred:      1850000 bytes

HTML transferred:       110000 bytes

Requests per second:    3264.11 [#/sec] (mean)

Time per request:       30.636 [ms] (mean)

Time per request:       0.306 [ms] (mean, across all concurrent requests)

Transfer rate:          589.71 [Kbytes/sec] received


Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        3   14  31.9     11    1115

Processing:     6   16   8.4     15     209

Waiting:        5   16   8.3     14     209

Total:         11   30  33.5     27    1130


Percentage of the requests served within a certain time (ms)

  50%     27

  66%     29

  75%     30

  80%     31

  90%     35

  95%     46

  98%     72

  99%     88

 100%   1130 (longest request)

dubbo平均响应结果为:
  (0.288+0.306)/2=0.297ms
 
cloud:
最高性能时期:

AppledeMacBook-Pro:~ apple$ ab -n 10000 -c 100 http://192.168.10.138:3002/

This is ApacheBench, Version 2.3 <$Revision: 1796539 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/


Benchmarking 192.168.10.138 (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests



Server Software:        

Server Hostname:        192.168.10.138

Server Port:            3002


Document Path:          /

Document Length:        33 bytes


Concurrency Level:      100

Time taken for tests:   2.379 seconds

Complete requests:      10000

Failed requests:        0

Total transferred:      2090000 bytes

HTML transferred:       330000 bytes

Requests per second:    4203.69 [#/sec] (mean)

Time per request:       23.789 [ms] (mean)

Time per request:       0.238 [ms] (mean, across all concurrent requests)

Transfer rate:          857.98 [Kbytes/sec] received


Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        4   10   2.1     10      28

Processing:     5   14   2.6     13      33

Waiting:        5   14   2.6     13      33

Total:         15   24   3.1     23      41


Percentage of the requests served within a certain time (ms)

  50%     23

  66%     24

  75%     25

  80%     26

  90%     27

  95%     29

  98%     32

  99%     34

 100%     41 (longest request)

最低性能时期:

AppledeMacBook-Pro:~ apple$ ab -n 10000 -c 100 http://192.168.10.138:3002/

This is ApacheBench, Version 2.3 <$Revision: 1796539 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/


Benchmarking 192.168.10.138 (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests



Server Software:        

Server Hostname:        192.168.10.138

Server Port:            3002


Document Path:          /

Document Length:        33 bytes


Concurrency Level:      100

Time taken for tests:   3.578 seconds

Complete requests:      10000

Failed requests:        0

Total transferred:      2090000 bytes

HTML transferred:       330000 bytes

Requests per second:    2795.10 [#/sec] (mean)

Time per request:       35.777 [ms] (mean)

Time per request:       0.358 [ms] (mean, across all concurrent requests)

Transfer rate:          570.48 [Kbytes/sec] received


Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        3   15  28.2     10    1242

Processing:     8   20  20.3     14     300

Waiting:        8   19  20.3     14     300

Total:         15   35  41.4     25    1255


Percentage of the requests served within a certain time (ms)

  50%     25

  66%     26

  75%     28

  80%     29

  90%     41

  95%    112

  98%    169

  99%    192

 100%   1255 (longest request)

cloud平均响应结果为:(
0.238+0.358)/2=0.298ms
 
cloud-zuul:
最高性能时期:

AppledeMacBook-Pro:~ apple$ ab -n 10000 -c 100 http://192.168.10.138:3000/test-comsumer/

This is ApacheBench, Version 2.3 <$Revision: 1796539 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/


Benchmarking 192.168.10.138 (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests



Server Software:        

Server Hostname:        192.168.10.138

Server Port:            3000


Document Path:          /test-comsumer/

Document Length:        118 bytes


Concurrency Level:      100

Time taken for tests:   3.269 seconds

Complete requests:      10000

Failed requests:        0

Non-2xx responses:      10000

Total transferred:      2710000 bytes

HTML transferred:       1180000 bytes

Requests per second:    3059.49 [#/sec] (mean)

Time per request:       32.685 [ms] (mean)

Time per request:       0.327 [ms] (mean, across all concurrent requests)

Transfer rate:          809.69 [Kbytes/sec] received


Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        3   12  71.0      7    1248

Processing:     4   21  15.8     17     220

Waiting:        4   21  15.7     17     220

Total:          8   33  73.0     25    1284


Percentage of the requests served within a certain time (ms)

  50%     25

  66%     30

  75%     33

  80%     36

  90%     43

  95%     50

  98%     61

  99%     84

 100%   1284 (longest request)

最低性能时期:

AppledeMacBook-Pro:~ apple$ ab -n 10000 -c 100 http://192.168.10.138:3000/test-comsumer/

This is ApacheBench, Version 2.3 <$Revision: 1796539 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/


Benchmarking 192.168.10.138 (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests



Server Software:        

Server Hostname:        192.168.10.138

Server Port:            3000


Document Path:          /test-comsumer/

Document Length:        118 bytes


Concurrency Level:      100

Time taken for tests:   4.796 seconds

Complete requests:      10000

Failed requests:        0

Non-2xx responses:      10000

Total transferred:      2710000 bytes

HTML transferred:       1180000 bytes

Requests per second:    2085.16 [#/sec] (mean)

Time per request:       47.958 [ms] (mean)

Time per request:       0.480 [ms] (mean, across all concurrent requests)

Transfer rate:          551.83 [Kbytes/sec] received


Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        2   20 114.6      7    1292

Processing:     4   28  18.0     25     135

Waiting:        4   27  18.0     24     135

Total:          6   48 118.1     34    1376


Percentage of the requests served within a certain time (ms)

  50%     34

  66%     43

  75%     49

  80%     53

  90%     64

  95%     78

  98%    141

  99%    166

 100%   1376 (longest request)

cloud-zuul
平均响应结果为:(0.480+0.327)/2=0.4035ms
 

发现一个现象:
dubbo的每次测试除去网络波动之外,都表现非常稳定
而cloud在第一次最慢,之后越来越快,连续测试4次以上单次测试性能超过dubbo
cloud-zuul在第一次最慢,之后也表现越来越快,连续4次以上测试 单次性能与dubbo相近,相差在0.02ms内

你可能感兴趣的:(springcloud与dubbo的性能对比)