You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add global ingestion rate limiter to distributors (#1766)
* Upgraded golang.org/x/time introducing rate.Limit.SetBurst()
Signed-off-by: Marco Pracucci <[email protected]>
* Added a global ingestion rate limiter
Signed-off-by: Marco Pracucci <[email protected]>
* Commented ReadRegistry mock to fix linter errors
Signed-off-by: Marco Pracucci <[email protected]>
* Added PR number to changelog entry
Signed-off-by: Marco Pracucci <[email protected]>
* Replaced distributors service discovery with the ring
Signed-off-by: Marco Pracucci <[email protected]>
* Fixed linter errors
Signed-off-by: Marco Pracucci <[email protected]>
* Fixed TSDB ingester initialization after rebasing with master
Signed-off-by: Marco Pracucci <[email protected]>
* Tested distributor.RingConfig
Signed-off-by: Marco Pracucci <[email protected]>
* Enriched ring.Lifecycler tests
Signed-off-by: Marco Pracucci <[email protected]>
* Renamed distributor's internalDependency param into canJoinRing to make it more clear
Signed-off-by: Marco Pracucci <[email protected]>
* Removed 'consul' and 'ingester' from ring logs, because it's not necessarily a ring of ingesters backed by consul
Signed-off-by: Marco Pracucci <[email protected]>
* Fixes after rebasing with master
Signed-off-by: Marco Pracucci <[email protected]>
* Changed ring key reference in the ingester, to keep code consistency
Signed-off-by: Marco Pracucci <[email protected]>
* Moved ReadLifecycler interface definition at the place of consumption
Signed-off-by: Marco Pracucci <[email protected]>
* Re-introduced -distributor.limiter-reload-period but deprecated
Signed-off-by: Marco Pracucci <[email protected]>
* Removed spurious bmizerany/assert dependency
Signed-off-by: Marco Pracucci <[email protected]>
* Fixed issues after rebasing master
Signed-off-by: Marco Pracucci <[email protected]>
* Fixed issues after rebasing master
Signed-off-by: Marco Pracucci <[email protected]>
* Updated changed with a CHANGE entry too
Signed-off-by: Marco Pracucci <[email protected]>
* Updated doc
Signed-off-by: Marco Pracucci <[email protected]>
* Renamed variable in distributor.New()
Signed-off-by: Marco Pracucci <[email protected]>
* Fix distributor tests when running on a system without eth0 and en0
Signed-off-by: Marco Pracucci <[email protected]>
*[FEATURE] The distributor can now drop labels from samples (similar to the removal of the replica label for HA ingestion) per user via the `distributor.drop-label` flag. #1726
The per-tenant rate limit (and burst size), in samples per second. Enforced on a per distributor basis, actual effective rate limit will be N times higher, where N is the number of distributor replicas.
298
+
The per-tenant rate limit (and burst size), in samples per second. It supports two strategies: `local`(default) and `global`.
298
299
299
-
**NB** Limits are reset every `-distributor.limiter-reload-period`, as such if you set a very high burst limit it will never be hit.
300
+
The `local` strategy enforces the limit on a per distributor basis, actual effective rate limit will be N times higher, where N is the number of distributor replicas.
301
+
302
+
The `global` strategy enforces the limit globally, configuring a per-distributor local rate limiter as `ingestion_rate / N`, where N is the number of distributor replicas (it's automatically adjusted if the number of replicas change). The `ingestion_burst_size` refers to the per-distributor local rate limiter (even in the case of the `global` strategy) and should be set at least to the maximum number of samples expected in a single push request.
303
+
304
+
The `global` strategy requires the distributors to form their own ring, which is used to keep track of the current number of healthy distributor replicas. The ring is configured by `distributor: { ring: {}}` / `-distributor.ring.*`.
// RegisterFlags adds the flags required to config this to the given FlagSet
135
139
func (cfg*Config) RegisterFlags(f*flag.FlagSet) {
136
140
cfg.BillingConfig.RegisterFlags(f)
137
141
cfg.PoolConfig.RegisterFlags(f)
138
142
cfg.HATrackerConfig.RegisterFlags(f)
143
+
cfg.DistributorRing.RegisterFlags(f)
139
144
140
145
f.BoolVar(&cfg.EnableBilling, "distributor.enable-billing", false, "Report number of ingested samples to billing system.")
141
146
f.IntVar(&cfg.MaxRecvMsgSize, "distributor.max-recv-msg-size", 100<<20, "remote_write API max receive message size (bytes).")
142
147
f.DurationVar(&cfg.RemoteTimeout, "distributor.remote-timeout", 2*time.Second, "Timeout for downstream ingesters.")
143
148
f.DurationVar(&cfg.ExtraQueryDelay, "distributor.extra-query-delay", 0, "Time to wait before sending more than the minimum successful query requests.")
144
-
f.DurationVar(&cfg.LimiterReloadPeriod, "distributor.limiter-reload-period", 5*time.Minute, "Period at which to reload user ingestion limits.")
149
+
flagext.DeprecatedFlag(f, "distributor.limiter-reload-period", "DEPRECATED. No more required because the local limiter is reconfigured as soon as the overrides change.")
145
150
f.BoolVar(&cfg.ShardByAllLabels, "distributor.shard-by-all-labels", false, "Distribute samples based on all labels, as opposed to solely by user and metric name.")
0 commit comments