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

Add DDSketch as an option for Metric Aggregation. #2063

Closed
wants to merge 4 commits into from

Conversation

tylerbenson
Copy link
Member

Will require #2037 (or something like it) in order to actually be usable.

Current iteration also doesn't map to any protobuf format.


/** Must be called under lock. */
private void drain() {
assert Thread.holdsLock(lock);
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't generally use assert in this codebase. Can you use the @GuardedBy("lock") annotation on the method instead?

import org.openjdk.jmh.annotations.Warmup;

@State(Scope.Benchmark)
public class DDSketchAggregatorBenchmark {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you publish some benchmarks? What kind of throughput can this implementation handle, with the lock on every recording?

sum,
Arrays.asList(
ValueAtPercentile.create(0.0, current.getMinValue()),
ValueAtPercentile.create(100.0, current.getMaxValue())));
Copy link
Contributor

Choose a reason for hiding this comment

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

I would have thought we would get more percentiles out of the sketch. Is that for a later PR?

@jkwatson
Copy link
Contributor

I'm pretty worried about requiring a lock on every metric recording that goes through this aggregator. Could we drop recordings if we can't keep up, rather than adding another lock in that path?


// Since DDSketch is not thread safe, this queue is used to buffer calls to record, reducing
// the need to take a lock for every call. (With the downside of having to box the double.)
private final ArrayBlockingQueue<Double> pendingValues = new ArrayBlockingQueue<>(64);
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't a blocking queue also imply a taking a lock on every call? (it's a blocking queue :) ).

https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/concurrent/ArrayBlockingQueue.java#L344

Is the idea that it would be less time under lock than if always calling current.accept?

@jkwatson
Copy link
Contributor

jkwatson commented Dec 4, 2020

Had a discussion in the metrics SIG today, and everyone pretty much agrees we should revert to just doing a simple synchronized lock around the recordings and ditch the queue in front of it. We can benchmark that and see how it performs before we do something fancier.

Base automatically changed from master to main January 26, 2021 00:26
@jkwatson
Copy link
Contributor

@tylerbenson I'm going to close this for now, unless you're going to have time to update it for the latest changes to the metrics SDK. Please re-open if appropriate.

@jkwatson jkwatson closed this Aug 16, 2021
@tylerbenson
Copy link
Member Author

Good call. Sorry for leaving this open for so long.

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

Successfully merging this pull request may close these issues.

3 participants