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

nsqd: Validate E2E percentiles & fix the config example #988

Merged
merged 1 commit into from
Jan 25, 2018

Conversation

protoss-player
Copy link
Contributor

@protoss-player protoss-player commented Jan 19, 2018

Passing values greater than 1 makes quantile library go nuts and consume lots of memory and CPU after a couple of minutes under ~1000 messages/second. I believe nsqd should exit with error instead of pretending that everything's OK in that case.

Also, example config contradicted the nsqd's CLI, which stated that percentile values should be from (0.0; 1.0].


Addresses #899.

@protoss-player protoss-player changed the title CLI: Validate E2E percentiles & fix the config example nsqd: Validate E2E percentiles & fix the config example Jan 19, 2018
@@ -220,6 +220,13 @@ func (p *program) Start() error {
cfg.Validate()

options.Resolve(opts, flagSet, cfg)

for _, v := range opts.E2EProcessingLatencyPercentiles {
if v <= 0 || v > 1 {
Copy link
Member

Choose a reason for hiding this comment

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

this line:

https://github.com/bmizerany/perks/blob/master/quantile/stream.go#L62

makes me think that 1.0 might not be an acceptable value ... though I don't understand the algorithm and can't say for sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems like 1.0 is legit, since the math you pointed at evaluates to +Inf in this case, and thus should not affect the if f < m logic a couple of lines below.

Copy link
Member

Choose a reason for hiding this comment

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

I had to run a little experiment of my own to be sure ... dividing by zero here indeed does result in +Inf instead of NaN or a trap or something.

One more thing: the rest of the argument checking is done in NSQD.New() (in nsqd/nsqd.go) so this should probably go there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Passing values greater than 1.0 made `quantile` library go nuts
and consume lots of memory and CPU after a couple of minutes
under ~1000 messages/second. I believe `nsqd` should exit with
error instead of pretending that everything's OK in that case.

Also, example config contradicted the nsqd's CLI, which stated
that percentile values should be from `(0.0; 1.0]`.
@ploxiln
Copy link
Member

ploxiln commented Jan 25, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants