Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apiserver: rate-limit logsink receives #7474

Merged
merged 1 commit into from Jun 19, 2017
Merged

Conversation

axw
Copy link
Contributor

@axw axw commented Jun 8, 2017

Description of change

Update the logsink handler so that it will
rate-limit receipt of log messages. Rate-limiting
defaults to a burst of 1000 messages, after
which we allow 1 message per millisecond. This
is configurable by modifying the controller
agent's agent.conf. If we find that users
need to configure it regularly, we can promote
the configuration to controller config.

QA steps

  1. juju bootstrap localhost
  2. juju model-config -m controller logging-config='=TRACE'
  3. juju ssh -m controller 0 "sudo tail -F /var/log/juju/logsink.log"

Observe that the logs come in quickly.

  1. juju ssh -m controller 0
  2. edit /var/lib/juju/agents/machine-0/agent.conf, adding LOGSINK_RATELIMIT_REFILL: 1s under values.
  3. sudo service jujud-machine-0 restart

Observe that the log messages come in quickly to begin with (up to 1000 messages), and then they are limited to 1 per second.

Documentation changes

Probably not until we know that people need to tweak the defaults, at which point we can add controller-config.

Bug reference

None.

@axw axw force-pushed the logsink-ratelimit-2.2 branch 2 times, most recently from d187a52 to e760375 Compare June 8, 2017 09:33
Copy link

@mjs mjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Thanks.

How did you decide on the default rate limiting values?

LogSink: apiserver.LogSinkConfig{
RateLimitBurst: apiserver.DefaultLogSinkRateLimitBurst,
RateLimitRefill: apiserver.DefaultLogSinkRateLimitRefill,
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nicer if LogSink was a pointer. Then if it's nil then the defaults could be used. This might be preferable to having to specify the defaults all over the place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done that in my other PR that makes the db logging parameters configurable. I'll rebase this once that has landed.

@axw
Copy link
Contributor Author

axw commented Jun 15, 2017

How did you decide on the default rate limiting values?

Pretty arbitrarily; 1000 log messages/s per agent seems like quite a lot already to me. I tested this with canonical-kubernetes, and it didn't cause any backing up. I'll put it in the cards to do some scale testing before we release 2.2.1.

@axw
Copy link
Contributor Author

axw commented Jun 19, 2017

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jun 19, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot
Copy link
Collaborator

jujubot commented Jun 19, 2017

Build failed: Generating tarball failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/11153

Update the logsink handler so that it will
rate-limit receipt of log messages. Rate-limiting
defaults to a burst of 1000 messages, after
which we allow 1 message per millisecond. This
is configurable by modifying the controller
agent's agent.conf. If we find that users
need to configure it regularly, we can promote
the configuration to controller config.
@axw
Copy link
Contributor Author

axw commented Jun 19, 2017

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Jun 19, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 9700197 into juju:2.2 Jun 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants