设置如下策略熔断策略
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
apiVersion: networking.istio.io/v1beta1 kind: DestinationRule metadata: creationTimestamp: "2020-06-22T03:11:20Z" generation: 4 name: productpage namespace: istio-bookinfo spec: host: productpage subsets: - labels: version: v1 name: v1 trafficPolicy: connectionPool: http: http1MaxPendingRequests: 1 maxRequestsPerConnection: 1 tcp: maxConnections: 1 outlierDetection: baseEjectionTime: 3m consecutiveErrors: 1 interval: 1s maxEjectionPercent: 100 |
测试结果显示大约38%左右被熔断
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$ siege -c 3 -b http://istiobookinfo.lab.f5se.io/productpage ^C { "transactions": 98, "availability": 38.13, "elapsed_time": 25.20, "data_transferred": 4.98, "response_time": 0.76, "transaction_rate": 3.89, "throughput": 0.20, "concurrency": 2.97, "successful_transactions": 98, "failed_transactions": 159, "longest_transaction": 6.17, "shortest_transaction": 0.01 } |
envoy上的配置,熔断是在cluster里
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
{ "version_info": "2020-06-23T02:35:43Z/123", "cluster": { "@type": "type.googleapis.com/envoy.api.v2.Cluster", "name": "outbound|9080||productpage.istio-bookinfo.svc.cluster.local", "type": "EDS", "eds_cluster_config": { "eds_config": { "ads": {} }, "service_name": "outbound|9080||productpage.istio-bookinfo.svc.cluster.local" }, "connect_timeout": "10s", "max_requests_per_connection": 1, "circuit_breakers": { "thresholds": [ { "max_connections": 1, "max_pending_requests": 1, "max_requests": 4294967295, "max_retries": 4294967295 } ] }, "outlier_detection": { "interval": "1s", "base_ejection_time": "180s", "max_ejection_percent": 100, "enforcing_consecutive_5xx": 0, "consecutive_gateway_failure": 1, "enforcing_consecutive_gateway_failure": 100 }, |
文章评论