kumahq / kuma

🐻 The multi-zone service mesh for containers, Kubernetes and VMs. Built with Envoy. CNCF Sandbox Project.
https://kuma.io/install
Apache License 2.0
3.67k stars 333 forks source link

RateLimitedBackOff set to 8 seconds retries after ~11 seconds #5707

Open slonka opened 1 year ago

slonka commented 1 year ago

What happened?

We're setting "x-retry-after" to 8 seconds but the delay is longer.

image

Also, request time was quite small so not sure what happened there: image

lobkovilya commented 1 year ago

ProxyTemplate to add response header:

apiVersion: kuma.io/v1alpha1
kind: ProxyTemplate
mesh: default
metadata:
  name: custom-template-1
spec:
  selectors:
    - match:
        kuma.io/service: backend_kuma-demo_svc_3001
  conf:
    imports:
      - default-proxy
    modifications:
      - virtualHost:
          operation: remove
          match:
            name: "backend_kuma-demo_svc_3001"
      - virtualHost:
          operation: add
          match:
            routeConfigurationName: "inbound:backend_kuma-demo_svc_3001"
          value: |
            name: "backend_kuma-demo_svc_3001"
            domains:
            - "*"
            routes:
            - match:
                prefix: /
              route:
                cluster: "localhost:3001"
                timeout: "0s"
              responseHeadersToAdd:
                - header:
                    key: "x-retry-after-header"
                    value: "8"
slonka commented 1 year ago

Same thing happens on k3d locally (1st retry triggered after ~11 seconds):

image image

Fault injection:

apiVersion: kuma.io/v1alpha1
kind: FaultInjection
mesh: default
metadata:
  name: fi1
spec:
  sources:
    - match:
        kuma.io/service: frontend_kuma-demo_svc_8080
        kuma.io/protocol: http
  destinations:
    - match:
        kuma.io/protocol: http
        kuma.io/service: backend_kuma-demo_svc_3001
  conf:        
    abort:
      httpStatus: 500
      percentage: 80

MeshRetry:

apiVersion: kuma.io/v1alpha1
kind: MeshRetry
metadata:
  name: mesh-retry
  namespace: kuma-system
  labels:
    kuma.io/mesh: default
spec:
  targetRef:
    kind: Mesh
  to:
    - targetRef:
        kind: Mesh
      default:
        http: 
          numRetries: 5
          retryOn:
            - 5xx
          rateLimitedBackOff:
            resetHeaders:
              - name: "x-retry-after-header"
                format: "Seconds"

MeshTrace:

apiVersion: kuma.io/v1alpha1
kind: MeshTrace
metadata:
  name: default
  namespace: kuma-system
  labels:
    kuma.io/mesh: default # optional, defaults to `default` if unset
spec:
  targetRef:
    kind: Mesh
  default:
    backends:
      - zipkin:
          url: http://jaeger-collector.mesh-observability:9411/api/v2/spans

Default request timeout (timeout-all-default) changed to:

      requestTimeout: 120s
github-actions[bot] commented 1 year ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] commented 1 year ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] commented 1 year ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] commented 9 months ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] commented 6 months ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] commented 3 months ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.