一个简易,而且高性能的测试工具。以前使用的是ab,但发现envoy默认不支持http 1.0,而ab目前只支持http 1.0,因此完美的错开了。envoy是能够支持http 1.0的,可是我配置了下,好像没有成功,就没有深刻了,果断换了wrk,目前使用起来感受这个工具很好用。html
wkr通常线程数不宜过多, 核数的2到4倍足够了, 多了反而由于线程切换过多形成效率下降, 由于 wrk 不是使用每一个链接一个线程的模型, 而是经过异步网络 io 提高并发量. 因此网络通讯不会阻塞线程执行,这也是 wrk 能够用不多的线程模拟大量网路链接的缘由。 而如今不少性能工具并无采用这种方式, 而是采用提升线程数来实现高并发, 因此并发量一旦设的很高, 测试机自身压力就很大, 测试效果反而降低。git
安装参考github
refer:
https://www.cnblogs.com/xinzh...
命令行:docker
wrk -t100 -c10000 -d60s --timeout 60s http://ambassador.default.svc...:80/http-echo/
[root@master01 ambassador]# wrk Usage: wrk <options> <url> Options: -c, --connections <N> Connections to keep open -d, --duration <T> Duration of test -t, --threads <N> Number of threads to use -s, --script <S> Load Lua script file -H, --header <H> Add header to request --latency Print latency statistics --timeout <T> Socket/request timeout -v, --version Print version details Numeric arguments may include a SI unit (1k, 1M, 1G) Time arguments may include a time unit (2s, 2m, 2h)
后台服务为go写的http server,参考: https://github.com/hashicorp/...api
--- apiVersion: v1 kind: Service metadata: name: http-echo annotations: getambassador.io/config: | --- apiVersion: ambassador/v0 kind: Mapping name: httpecho_mapping prefix: /http-echo/ service: http-echo spec: selector: app: http-echo ports: - port: 80 name: http-echo targetPort: 5678 --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name: http-echo spec: replicas: 6 strategy: type: RollingUpdate template: metadata: labels: app: http-echo spec: containers: - name: http-echo image: hashicorp/http-echo args: ["-text=\"hello world\""] ports: - name: httpa containerPort: 5678 resources: limits: cpu: "1" memory: 512Mi
component | version | |
---|---|---|
docker | 1.13.1 | |
k8s | 1.15.2 | |
ambassador | 0.83.0 | |
envoy | 1.12.0 |
component | replica | resource | |
---|---|---|---|
http-echo | 3副本 | 1C1G | |
ambassador | 10副本 | 2C0.5G |
wrk -t100 -c10000 -d60s --timeout 60s http://http-echo.default.svc....:80
wrk -t100 -c1000 -d60s --timeout 60s http://ambassador.default.svc...:80/http-echo/
method | concurrency | time | rqs | transfer/sec | latency avg | latency max | latency std |
---|---|---|---|---|---|---|---|
service | 1000 | 1st | 53709.17 | 9.01MB | 31.36ms | 689.04ms | 80.48% |
service | 1000 | 2nd | 53452.36 | 8.97MB | 31.55ms | 497.89ms | 80.89% |
service | 10000 | 1st | 59413.33 | 9.97MB | 225.50ms | 6.90s | 91.98% |
service | 10000 | 2nd | 59920.76 | 10.06MB | 223.60ms | 8.71s | 92.36% |
ambassador | 1000 | 1st | 30484.25 | 6.55MB | 38.44ms | 367.21ms | 68.18% |
ambassador | 1000 | 2nd | 30688.21 | 6.59MB | 38.30ms | 304.27ms | 67.30% |
ambassador | 10000 | 1st | 30512.20 | 6.59MB | 335.20ms | 4.24s | 70.35% |
ambassador | 10000 | 2nd | 30977.12 | 6.69MB | 336.08ms | 3.69s | 71.70% |