当前位置:网站首页>Kitex retry mechanism

Kitex retry mechanism

2022-07-07 11:05:00 wangxiaoming

Kitex Retry mechanism

When will I try again ?

kitex Crazy Jane currently has the following three retry mechanisms :

  • Time out to try again
  • Backup Request( No response received for a period of time , retry )
  • Connection failed. Try again

The framework currently has three types of retries : Time out to try again 、Backup Request, Failed to create connection. Try again ( Default ). The connection failure is a network level problem , Because the request was not sent , The framework will retry by default , Business needs no attention .

Time out to try again

Timeout exception due to network jitter , High downstream load or GC And so on GC Jamming leads to timeout .

How to set the retrying policy ?

There are generally three kinds of exceptions :

  • Business customization exception
  • Timeout exception
  • Non timeout framework class exception

There are generally two ways to make abnormal business judgments

  • Thrown downstream Error

  • The error code returned by the downstream

  • return Error The custom exception configuration method is as follows :

RetryWithError(IsErrorRetry)
  • adopt BaseResp Custom error code configuration
RetryWithResult(IsResultRetry)
  • Retry count configuration
    Maximum number of retries , Stop retrying if the maximum number of retries is exceeded .
WithMaxRetry
原网站

版权声明
本文为[wangxiaoming]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070854222860.html