ambassador envoy 简单性能测试

wrk

一个简易,并且高性能的测试工具。之前使用的是ab,但发现envoy默认不支持http 1.0,而ab目前只支持http 1.0,所以完美的错开了。envoy是可以支持http 1.0的,但是我配置了下,好像没有成功,就没有深入了,果断换了wrk,目前使用起来感觉这个工具很好用。

wkr一般线程数不宜过多, 核数的2到4倍足够了, 多了反而因为线程切换过多造成效率降低, 因为 wrk 不是使用每个连接一个线程的模型, 而是通过异步网络 io 提升并发量. 所以网络通信不会阻塞线程执行,这也是 wrk 可以用很少的线程模拟大量网路连接的原因。 而现在很多性能工具并没有采用这种方式, 而是采用提高线程数来实现高并发, 所以并发量一旦设的很高, 测试机自身压力就很大, 测试效果反而下降。

安装参考

refer:
https://www.cnblogs.com/xinzh...

命令行:

wrk -t100 -c10000 -d60s --timeout 60s http://ambassador.default.svc...:80/http-echo/
[root@master01 ambassador]# wrk
Usage: wrk                              
  Options:                                            
    -c, --connections   Connections to keep open   
    -d, --duration      Duration of test           
    -t, --threads       Number of threads to use   
                                                      
    -s, --script        Load Lua script file       
    -H, --header        Add header to request      
        --latency          Print latency statistics   
        --timeout       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)

http sever

后台服务为go写的http server,参考: https://github.com/hashicorp/...

deployment.yaml

---
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

ambassador

install deploy

测试数据

环境

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

测试数据

service

wrk -t100 -c10000 -d60s --timeout 60s http://http-echo.default.svc....:80

ambassador

wrk -t100 -c1000 -d60s --timeout 60s http://ambassador.default.svc...:80/http-echo/

couclusion

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%

你可能感兴趣的:(envoy,performance,concurrency)