GRPC Retry Policy and Timeout together

110 views Asked by At

We want to use GRPC config with both timeout and retryPolicy.

Config looks like

{
    "methodConfig": [
        {
            "name": [
                {
                    "service": "someService",
                    "method": "someMethod"
                }
            ],
            "timeout": "0.5s",
            "retryPolicy": {
                "maxAttempts": 2,
                "initialBackoff": "0.2s",
                "maxBackoff": "2s",
                "backoffMultiplier": 2,
                "retryableStatusCodes": [
                    "UNAVAILABLE",
                    "CANCELLED",
                    "UNKNOWN",
                    "UNIMPLEMENTED"
                ]
            }
        }
    ]
}

Question is how retryPolicy and timeout work together? Timeout affects on single GRPC-call (maxAttempts=2, timeout=0.5s, total timeout=1s) or on call with retries(timeout=total timeout=0.5s)? Are there any problems with this config?

Using this config we always get DELADLINE_EXCEEDED status from someMethod. But without config it works fast (100ms).

1

There are 1 answers

0
Yuri Golobokov On

The timeout is the total timeout.

If you are using grpc-java, I think you may be getting DEADLINE_EXCEEDED because of this bug: https://github.com/grpc/grpc-java/issues/10336