Skip to content

Commit c5f1a37

Browse files
metacosmcsviri
authored andcommitted
docs: improve/clarify
1 parent 398f343 commit c5f1a37

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

docs/documentation/features.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -326,28 +326,37 @@ intersections:
326326

327327
## Rate Limiting
328328

329-
It is possible to rate limit reconciliation for a resource. Thus rate limiting is per resource,
330-
and it takes precedence over retry and re-schedule configurations. So for example event a retry is scheduled in
331-
1 seconds but this does not meet the rate limit, the next reconciliation will be postponed according rate limiting rules;
332-
however never cancelled, just executed as early as possible according rate limit configuration.
333-
334-
Rate limiting is by default turned off, since correct configuration depends on the reconciler implementation, and
335-
how long an execution takes.
336-
(The parallelism of reconciliation itself can be limited [`ConfigurationService`](https://github.com/java-operator-sdk/java-operator-sdk/blob/ce4d996ee073ebef5715737995fc3d33f4751275/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java#L120-L120)
337-
by setting appropriate ExecutorService.)
338-
339-
A default implementation of rate limiter is provided, see: [`PeriodRateLimiter`](https://github.com/java-operator-sdk/java-operator-sdk/blob/ce4d996ee073ebef5715737995fc3d33f4751275/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/rate/PeriodRateLimiter.java#L14-L14).
340-
Users can override it with a custom implementation of
329+
It is possible to rate limit reconciliation on a per-resource basis. The rate limit also takes
330+
precedence over retry/re-schedule configurations: for example, even if a retry was scheduled for
331+
the next second but this request would make the resource go over its rate limit, the next
332+
reconciliation will be postponed according to the rate limiting rules. Note that the
333+
reconciliation is never cancelled, it will just be executed as early as possible based on rate
334+
limitations.
335+
336+
Rate limiting is by default turned **off**, since correct configuration depends on the reconciler
337+
implementation, in particular, on how long a typical reconciliation takes.
338+
(The parallelism of reconciliation itself can be
339+
limited [`ConfigurationService`](https://github.com/java-operator-sdk/java-operator-sdk/blob/ce4d996ee073ebef5715737995fc3d33f4751275/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/ConfigurationService.java#L120-L120)
340+
by configuring the `ExecutorService` appropriately.)
341+
342+
A default rate limiter implementation is provided, see:
343+
[`PeriodRateLimiter`](https://github.com/java-operator-sdk/java-operator-sdk/blob/ce4d996ee073ebef5715737995fc3d33f4751275/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/rate/PeriodRateLimiter.java#L14-L14)
344+
.
345+
Users can override it by implementing their own
341346
[`RateLimiter`](https://github.com/java-operator-sdk/java-operator-sdk/blob/ce4d996ee073ebef5715737995fc3d33f4751275/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/rate/RateLimiter.java)
342-
interface.
347+
.
343348

344-
To configure the default rate limiter use `@ControllerConfiguration` annotation. The following configuration limits
345-
the reconciliation to 2 in 3 seconds:
349+
To configure the default rate limiter use `@ControllerConfiguration` annotation. The following
350+
configuration limits
351+
each resource to reconcile at most twice within a 3 second interval:
346352

347-
`@ControllerConfiguration(rateLimit = @RateLimit(limitForPeriod = 2,refreshPeriod = 3,refreshPeriodTimeUnit = TimeUnit.SECONDS))`.
353+
`@ControllerConfiguration(rateLimit = @RateLimit(limitForPeriod = 2,refreshPeriod = 3,refreshPeriodTimeUnit = TimeUnit.SECONDS))`
354+
.
348355

349-
That means if the reconciler executed twice in one second, it will wait at least additional two seconds before it is
350-
reconciled again.
356+
Thus, if a given resource was reconciled twice in one second, no further reconciliation for this
357+
resource will happen before two seconds have elapsed. Note that, since rate is limited on a
358+
per-resource basis, other resources can still be reconciled at the same time, as long, of course,
359+
that they stay within their own rate limits.
351360

352361

353362
## Handling Related Events with Event Sources

0 commit comments

Comments
 (0)