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 CPU time to metrics for segment scanning. #1696

Merged
merged 1 commit into from
Sep 14, 2015

Conversation

drcrallen
Copy link
Contributor

This is an alternative to #1298

This PR only reports CPU usage during the compute heavy portions of the query runner by wrapping the yielder calls (or at least is supposed to) and only reports metrics once per query including having a query ID.

The prior PR (#1298) reported cpu usage as part of the metrics emitting executor service by wrapping the runnables and callables, and didn't have a good way to get context for why the CPU was being used.

Overall I think this PR is a better way to go because it has better reporting over the context of the CPU usage.

final Query<T> query, final Map<String, Object> responseContext
)
{
final Sequence<T> baseSequence = delegate.run(query, responseContext);
Copy link
Member

Choose a reason for hiding this comment

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

if report is set to false, we can just return the baseSequence here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because it still accumulates.

Copy link
Member

Choose a reason for hiding this comment

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

got it.

@nishantmonu51
Copy link
Member

👍

@drcrallen drcrallen added this to the 0.8.2 milestone Sep 3, 2015
@himadrisingh001
Copy link
Contributor

👍

@himanshug
Copy link
Contributor

@drcrallen are we intentionally not making ServerManager like updates for the broker so that broker also report same metric?

)
{
if (!THREAD_MX_BEAN.isThreadCpuTimeEnabled()) {
throw new ISE("Cpu time must enabled");
Copy link
Contributor

Choose a reason for hiding this comment

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

documentation is not very explicit about when this will happen. Is it possible to not fail here and print some warn/error log saying cpu metrics can't be reported?

Copy link
Contributor

Choose a reason for hiding this comment

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

nvmd, just noticed safeBuild below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, safeBuild is the intended public constructor

@drcrallen
Copy link
Contributor Author

@himanshug Not in this PR. The appropriate runner could be wrapped at the broker level using the same approach but I purposefully left it out of this PR to limit the scope.

@himanshug
Copy link
Contributor

LGTM

himanshug added a commit that referenced this pull request Sep 14, 2015
Add CPU time to metrics for segment scanning.
@himanshug himanshug merged commit 5ff9266 into apache:master Sep 14, 2015
@drcrallen drcrallen deleted the cpuTimeReporting branch September 14, 2015 16:10
toolChest
return CPUTimeMetricQueryRunner.safeBuild(
new FinalizeResultsQueryRunner<T>(
toolChest.mergeResults(factory.mergeRunners(exec, queryRunners)),
Copy link
Member

Choose a reason for hiding this comment

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

@drcrallen implementation of most QueryRunnerFactory.mergeRunners() methods delegates to ChainedExecutionQueryRunner, that delegates actual processing to a provided executor. Hence it seems to me that CPU Time wrapping should happen before mergeRunners(). What do you think?

Copy link
Member

@leventov leventov Oct 31, 2018

Choose a reason for hiding this comment

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

Ok I see, there is a distinct cpuTimeAccumulator variable used above to accumulate those metrics.

seoeun25 pushed a commit to seoeun25/incubator-druid that referenced this pull request Jan 10, 2020
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.

None yet

5 participants