istio部署demoapp应用 (十二)连接池

Connection Pool

  • Traffic Policy支持connectionPool设定;存在两种类型的pool

    • tcp Pool

      • 最大连接数100

      • 超时时长30ms

      • 启用的tcpkeepalive功能,时长为7200s

    • HTTP Pool

      • http2最大连接数100

      • 每连接的最大请求数10

destinationrule-demoapp.yaml

apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
  name: demoapp
spec:
  host: demoapp
  trafficPolicy:
    loadBalancer:
      simple: LEAST_CONN
    connectionPool:
      tcp:
        maxConnections: 100
        connectTimeout: 30ms
        tcpKeepalive:
          time: 7200s
          interval: 75s
      http:
        http2MaxRequests: 1000
        maxRequestsPerConnection: 10
  subsets:
  - name: v10
    labels:
      version: v1.0
    trafficPolicy:
      loadBalancer:
        consistentHash:
          httpHeaderName: X-User
  - name: v11
    labels:
      version: v1.1

virutalservice-demoapp.yaml

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: demoapp
spec:
  hosts:
  - demoapp
  http:
  - name: canary
    match:
    - uri:
        prefix: /canary
    rewrite:
      uri: /
    route:
    - destination:
        host: demoapp
        subset: v11
  - name: default
    route:
    - destination:
        host: demoapp
        subset: v10

参考文档

ConnectionPool:https://istio.io/latest/zh/docs/reference/config/networking/destination-rule/#ConnectionPoolSettings

TCP Pool:https://istio.io/latest/zh/docs/reference/config/networking/destination-rule/#ConnectionPoolSettings-TCPSettings

HTTP Pool:https://istio.io/latest/zh/docs/reference/config/networking/destination-rule/#ConnectionPoolSettings-HTTPSettings

posted @ 2022-10-27 14:09  小吉猫  阅读(103)  评论(0编辑  收藏  举报