Merge pull request #40628 from cpuguy83/19.03_backport_39360_swarm_log_fill_rate

[19.03] Fix rate limiting for logger, increase refill rate
This commit is contained in:
Sebastiaan van Stijn 2020-04-02 20:40:29 +02:00 committed by GitHub
commit d12b6d24d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -508,7 +508,9 @@ func (r *controller) Logs(ctx context.Context, publisher exec.LogPublisher, opti
var (
// use a rate limiter to keep things under control but also provides some
// ability coalesce messages.
limiter = rate.NewLimiter(rate.Every(time.Second), 10<<20) // 10 MB/s
// this will implement a "token bucket" of size 10 MB, initially full and refilled
// at rate 10 MB tokens per second.
limiter = rate.NewLimiter(10<<20, 10<<20) // 10 MB/s
msgctx = api.LogContext{
NodeID: r.task.NodeID,
ServiceID: r.task.ServiceID,