Skip to content

Conversation

@pxsalehi
Copy link
Member

@pxsalehi pxsalehi commented Jun 20, 2023

Track total task execution time in EWMATrackingEsThreadPoolExecutor and rename it.

Relates ES-6249

@pxsalehi pxsalehi force-pushed the ps230620-trackTotalExecTimeInExecutor branch 2 times, most recently from b49aa47 to 3226f32 Compare June 20, 2023 11:09
@pxsalehi pxsalehi force-pushed the ps230620-trackTotalExecTimeInExecutor branch from 3226f32 to e486e17 Compare June 20, 2023 11:23
* An extension to thread pool executor, which tracks statistics for the task execution time.
*/
public final class EWMATrackingEsThreadPoolExecutor extends EsThreadPoolExecutor {
public final class TaskExecutionTimeTrackingEsThreadPoolExecutor extends EsThreadPoolExecutor {
Copy link
Member Author

Choose a reason for hiding this comment

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

The names a bit verbose/long, but we rarely use it directly. I'm open for suggestions.

Copy link
Contributor

Choose a reason for hiding this comment

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

It follows the venerable Java naming tradition, it's good 😅

@pxsalehi pxsalehi added >non-issue :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. labels Jun 20, 2023
if (taskExecutionNanos != -1) {
// taskExecutionNanos may be -1 if the task threw an exception
executionEWMA.addValue(taskExecutionNanos);
totalExecutionTime.add(taskExecutionNanos);
Copy link
Member Author

Choose a reason for hiding this comment

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

I've kept this as nano (rather than millis). I think it is safe.

@pxsalehi pxsalehi marked this pull request as ready for review June 20, 2023 11:31
@elasticsearchmachine elasticsearchmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Jun 20, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Copy link
Contributor

@fcofdez fcofdez left a comment

Choose a reason for hiding this comment

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

LGTM, I left a couple of minor nits around tests

assertThat(executor.getTotalTaskExecutionTime(), equalTo(0L));
executeTask(executor, 1);
assertBusy(() -> { assertThat((long) executor.getTaskExecutionEWMA(), equalTo(30L)); });
assertBusy(() -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could we add a comment to note that fastWrapper makes each execution look like it took 100ns?


assertThat((long) executor.getTaskExecutionEWMA(), equalTo(0L));
executeTask(executor, 1);
int taskCount = randomIntBetween(1, 100);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: same as above, could we add a comment regarding exceptionalWrapper?

* An extension to thread pool executor, which tracks statistics for the task execution time.
*/
public final class EWMATrackingEsThreadPoolExecutor extends EsThreadPoolExecutor {
public final class TaskExecutionTimeTrackingEsThreadPoolExecutor extends EsThreadPoolExecutor {
Copy link
Contributor

Choose a reason for hiding this comment

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

It follows the venerable Java naming tradition, it's good 😅

@pxsalehi pxsalehi added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Jun 21, 2023
@elasticsearchmachine elasticsearchmachine merged commit 97b7ec9 into elastic:main Jun 21, 2023
@pxsalehi pxsalehi deleted the ps230620-trackTotalExecTimeInExecutor branch June 21, 2023 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. >non-issue Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.9.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants