码迷,mamicode.com
首页 > 其他好文 > 详细

traefik 与 rancher 集群自带haproxy 压测性能对比

时间:2017-04-21 18:15:16      阅读:308      评论:0      收藏:0      [点我收藏+]

标签:traefik   haproxy   压测   性能对比   

ab性能指标

在进行性能测试过程中有几个指标比较重要:


1、吞吐率(Requests per second)

服务器并发处理能力的量化描述,单位是reqs/s,指的是在某个并发用户数下单位时间内处理的请求数。某个并发用户数下单位时间内能处理的最大请求数,称之为最大吞吐率。

记住:吞吐率是基于并发用户数的。这句话代表了两个含义:

a、吞吐率和并发用户数相关

b、不同的并发用户数下,吞吐率一般是不同的

计算公式:总请求数/处理完成这些请求数所花费的时间,即

Request per second=Complete requests/Time taken for tests

必须要说明的是,这个数值表示当前机器的整体性能,值越大越好。


2、并发连接数(The number of concurrent connections)

并发连接数指的是某个时刻服务器所接受的请求数目,简单的讲,就是一个会话。


3、并发用户数(Concurrency Level)

要注意区分这个概念和并发连接数之间的区别,一个用户可能同时会产生多个会话,也即连接数。在HTTP/1.1下,IE7支持两个并发连接,IE8支持6个并发连接,FireFox3支持4个并发连接,所以相应的,我们的并发用户数就得除以这个基数。


4、用户平均请求等待时间(Time per request)

计算公式:处理完成所有请求数所花费的时间/(总请求数/并发用户数),即:

Time per request=Time taken for tests/(Complete requests/Concurrency Level)


5、服务器平均请求等待时间(Time per request:across all concurrent requests)

计算公式:处理完成所有请求数所花费的时间/总请求数,即:

Time taken for/testsComplete requests

可以看到,它是吞吐率的倒数。

同时,它也等于用户平均请求等待时间/并发用户数,即

Time per request/Concurrency Level


### 测试结果含义参考:

```

Document Path: /a.php //请求的资源

Document Length: 0 bytes // 文档返回的长度,不包括相应头


Concurrency Level: 1000 // 并发个数

Time taken for tests: 48.650 seconds //总请求时间 

Complete requests: 50000 // 总请求数

Failed requests: 0 //失败的请求数

Broken pipe errors: 0

Total transferred: 9750000 bytes

HTML transferred: 0 bytes

Requests per second: 1027.75 [#/sec] (mean) // 平均每秒的请求数

Time per request: 973.00 [ms] (mean) // 平均每个请求消耗的时间

Time per request: 0.97 [ms] (mean, across all concurrent requests) // 就是上面的时间 除以并发数

Transfer rate: 200.41 [Kbytes/sec] received // 时间传输速率

```



[root@container_node ~]# ab -n 50000 -c 10 http://nginx.test.local:8080/   


-c 100 即:每次并发100个

-n 10000 即: 共发送10000个请求



++++++++++++++++++++++++++++++ 10 并发 +++++++++后端: 9个container+++++++++++++++++++++++

### traefik 转发

[root@container_node ~]# ab -n 50000 -c 100 http://nginx.test.local:8080/

 6个container

```

Concurrency Level:      100

Time taken for tests:   5.351 seconds

Complete requests:      50000

Failed requests:        0

Write errors:           0

Total transferred:      11600000 bytes

HTML transferred:       1000000 bytes

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

Time per request:       10.701 [ms] (mean)

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

Transfer rate:          2117.11 [Kbytes/sec] received

```

### 使用rancher 集群 haproxy 

 ab -n 50000 -c 100  http://nginx.test.local:8080/

```

Concurrency Level:      100

Time taken for tests:   10.822 seconds

Complete requests:      50000

Failed requests:        0

Write errors:           0

Total transferred:      12550000 bytes

HTML transferred:       1000000 bytes

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

Time per request:       21.644 [ms] (mean)

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

Transfer rate:          1132.51 [Kbytes/sec] received

```


++++++++++++++++++++++++++++++ 100 并发 +++++++++后端: 9个container+++++++++++++++++++++++

### traefik 转发

[root@container_node ~]# ab -n 5000000 -c 100 -t 5 http://nginx.test.local:8080/

 9个container

```

Concurrency Level:      100

Time taken for tests:   4.728 seconds

Complete requests:      50000

Failed requests:        0

Write errors:           0

Total transferred:      11600000 bytes

HTML transferred:       1000000 bytes

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

Time per request:       9.456 [ms] (mean)

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

Transfer rate:          2395.97 [Kbytes/sec] received

```

### 使用rancher 集群 haproxy 转发

[root@container_node ~]# ab -n 5000000 -c 100  http://nginx.test.local:8080/

```

Concurrency Level:      100

Time taken for tests:   953.029 seconds

Complete requests:      5000000

Failed requests:        0

Write errors:           0

Total transferred:      1255000000 bytes

HTML transferred:       100000000 bytes

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

Time per request:       19.061 [ms] (mean)

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

Transfer rate:          1285.99 [Kbytes/sec] received

```



++++++++++++++++++++++++++++++ 50 并发 +++++++++后端: 9个container+++++++++++++++++++++++

### traefik 转发

[root@container_node ~]# ab -n 5000000 -c 50  http://nginx.test.local:8080/ 

```

Concurrency Level:      50

Time taken for tests:   545.354 seconds

Complete requests:      5000000

Failed requests:        0

Write errors:           0

Total transferred:      1160000000 bytes

HTML transferred:       100000000 bytes

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

Time per request:       5.454 [ms] (mean)

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

Transfer rate:          2077.21 [Kbytes/sec] received

```


### 使用rancher 集群 haproxy 转发


[root@container_node ~]# ab -n 5000000 -c 50  http://nginx.test.local:8080/

```

Concurrency Level:      50

Time taken for tests:   1082.314 seconds

Complete requests:      5000000

Failed requests:        0

Write errors:           0

Total transferred:      1255000000 bytes

HTML transferred:       100000000 bytes

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

Time per request:       10.823 [ms] (mean)

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

Transfer rate:          1132.38 [Kbytes/sec] received

```



++++++++++++++++++++++++++++++ 10 并发 +++++++++后端: 9个container+++++++++++++++++++++++


### traefik 转发

[root@container_node ~]# ab -n 5000000 -c 10  http://nginx.test.local:8080/ 

 

 9个container

```

Concurrency Level:      10

Time taken for tests:   582.869 seconds

Complete requests:      5000000

Failed requests:        0

Write errors:           0

Total transferred:      1160000000 bytes

HTML transferred:       100000000 bytes

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

Time per request:       1.166 [ms] (mean)

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

Transfer rate:          1943.51 [Kbytes/sec] received

```


### 使用rancher 集群 haproxy 转发

```

[root@container_node ~]# ab -n 5000000 -c 10  http://nginx.test.local:8080/


Concurrency Level:      10

Time taken for tests:   1340.674 seconds

Complete requests:      5000000

Failed requests:        0

Write errors:           0

Total transferred:      1255000000 bytes

HTML transferred:       100000000 bytes

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

Time per request:       2.681 [ms] (mean)

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

Transfer rate:          914.16 [Kbytes/sec] received

```

### traefik 与 nginx性能对比

https://docs.traefik.io/benchmarks/


本文出自 “康建华” 博客,谢绝转载!

traefik 与 rancher 集群自带haproxy 压测性能对比

标签:traefik   haproxy   压测   性能对比   

原文地址:http://michaelkang.blog.51cto.com/1553154/1918203

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!