我正在尝试为Service Bus瞬态错误实施重试策略。我希望我的系统能够成倍地尝试像1s,2s,4s,8s,16s,32s,64s,128s。
private int minBackoffDelayInMilliseconds = 2000;
private int maxBackoffDelayInMilliseconds = 10000;
private int deltaBackoffInMilliseconds = 2000;
var defaultPolicy = new RetryPolicy<ServiceBusTransientErrorDetectionStrategy>(new ExponentialBackoff(maxRetries, TimeSpan.FromMilliseconds(minBackoffDelayInMilliseconds), TimeSpan.FromMilliseconds(maxBackoffDelayInMilliseconds), TimeSpan.FromMilliseconds(deltaBackoffInMilliseconds))
这看起来不错吗?此政策是否会影响系统性能?
答案 0 :(得分:1)
这是Azure CAT团队的一篇很好的文章,展示了几个例子。
他们建议这样做:
namespaceManager.Settings.RetryPolicy = new RetryExponential(TimeSpan.FromSeconds(0.1),TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), 3);