Skip to content

Commit 7df3e8b

Browse files
authored
Merge pull request #395 from daipom/fix-wrong-calculation-of-retry
1.0: Fix wrong description of total retry time
2 parents 230158a + 06de24a commit 7df3e8b

File tree

3 files changed

+55
-6
lines changed

3 files changed

+55
-6
lines changed

buffer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ A chunk can fail to be written out to the destination for a number of reasons. T
4141
By default, Fluentd increases the wait interval exponentially for each retry attempt. For example, assuming that the initial wait interval is set to 1 second and the exponential factor is 2, each attempt occurs at the following time points:
4242

4343
```text
44-
1 2 4 8 16
44+
0 1 3 7 15
4545
x-x---x-------x---------------x-------------------------
4646
│ │ │ │ └─ 4th retry (wait = 8s)
4747
│ │ │ └───────────────── 3th retry (wait = 4s)

configuration/buffer-section.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,11 @@ Following are the flushing parameters for chunks to optimize performance \(laten
494494
* Default: 72h
495495
* The maximum time \(seconds\) to retry to flush again the failed chunks,
496496

497-
until the plugin discards the buffer chunks
497+
until the plugin discards the buffer chunks.
498+
499+
If the next retry is going to exceed this time limit, the last retry
500+
501+
will be made at exactly this time limit.
498502
* `retry_forever` \[bool\]
499503
* Default: `false`
500504
* If true, plugin will ignore `retry_timeout` and `retry_max_times`
@@ -546,7 +550,8 @@ With `exponential_backoff`, `retry_wait` interval will be calculated as below:
546550
* c: constant factor, `@retry_wait`
547551
* b: base factor, `@retry_exponential_backoff_base`
548552
* k: number of retry times
549-
* total retry time: `c + c * b^1 + (...) + c*b^k = c*b^(k+1) - 1`
553+
* total retry time: `c + c*b^1 + (...) + c*b^(k-1) = c*(b^k - 1) / (b - 1)`
554+
* = `2^k - 1` by default
550555

551556
If this article is incorrect or outdated, or omits critical information, please [let us know](https://github.com/fluent/fluentd-docs-gitbook/issues?state=open). [Fluentd](http://www.fluentd.org/) is an open-source project under [Cloud Native Computing Foundation \(CNCF\)](https://cncf.io/). All components are available under the Apache 2 License.
552557

output/README.md

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,18 @@ If the bottom chunk write out fails, it will remain in the queue and Fluentd wil
181181

182182
Writing out the bottom chunk is considered to be a failure if `Output#write` or `Output#try_write` method throws an exception.
183183

184+
The retry timings of `retry_timeout: 100s`.
185+
186+
| N-th retry | Elapsed |
187+
| :--- | :--- |
188+
| 1th | 1s |
189+
| 2th | 3s |
190+
| 3th | 7s |
191+
| 4th | 15s |
192+
| 5th | 31s |
193+
| 6th | 63s |
194+
| 7th | 100s |
195+
184196
#### `retry_type`
185197

186198
Specifies how to wait for the next retry to flush buffer.
@@ -198,13 +210,13 @@ Default: `false`
198210

199211
#### `retry_timeout`
200212

201-
The maximum seconds to retry to flush while failing, until the plugin discards the buffer chunks.
213+
The maximum seconds to retry to flush while failing, until the plugin discards the buffer chunks. If the next retry is going to exceed this time limit, the last retry will be made at exactly this time limit.
202214

203-
Default: `72` \(hours\)
215+
Default: `72h` \(72 hours\)
204216

205217
#### `retry_max_times`
206218

207-
The maximum number of times to retry to flush while failing. If `retry_timeout` is the default, the number is 17 with exponential backoff.
219+
The maximum number of times to retry to flush while failing. If `retry_timeout` is the default, the number is 18 with exponential backoff.
208220

209221
Default: `nil`
210222

@@ -268,5 +280,37 @@ This example sends logs to Elasticsearch using a file buffer `/var/log/td-agent/
268280

269281
NOTE: `<secondary>` plugin receives the primary's buffer chunk directly. So, you need to check if your secondary plugin works with the primary setting.
270282

283+
The retry timings of `retry_timeout: 100s` with the secondary.
284+
285+
| N-th retry | Elapsed | Output plugin |
286+
| :--- | :--- | :--- |
287+
| 1th | 1s | primary |
288+
| 2th | 3s | primary |
289+
| 3th | 7s | primary |
290+
| 4th | 15s | primary |
291+
| 5th | 31s | primary |
292+
| 6th | 63s | primary |
293+
| 7th | 80s | secondary |
294+
| 8th | 81s | secondary |
295+
| 9th | 83s | secondary |
296+
| 10th | 87s | secondary |
297+
| 11th | 95s | secondary |
298+
| 12th | 100s | secondary |
299+
300+
The retry timings of `retry_max_times: 10` with the secondary.
301+
302+
| N-th retry | Elapsed | Output plugin |
303+
| :--- | :--- | :--- |
304+
| 1th | 1s | primary |
305+
| 2th | 3s | primary |
306+
| 3th | 7s | primary |
307+
| 4th | 15s | primary |
308+
| 5th | 31s | primary |
309+
| 6th | 63s | primary |
310+
| 7th | 127s | primary |
311+
| 8th | 255s | primary |
312+
| 9th | 511s | primary |
313+
| 10th | 818s | secondary |
314+
271315
If this article is incorrect or outdated, or omits critical information, please [let us know](https://github.com/fluent/fluentd-docs-gitbook/issues?state=open). [Fluentd](http://www.fluentd.org/) is an open-source project under [Cloud Native Computing Foundation \(CNCF\)](https://cncf.io/). All components are available under the Apache 2 License.
272316

0 commit comments

Comments
 (0)