Skip to content

Conversation

@dakrone
Copy link
Member

@dakrone dakrone commented May 31, 2017

This is the first step towards adaptive replica selection (#24915). This PR
tracks the execution time, also known as the "service time" of a task in the
threadpool. The QueueResizingEsThreadPoolExecutor then stores a moving average
of these task times which can be retrieved from the executor.

Currently there is no functionality using the EWMA yet (other than tests), this
is only a bite-sized building block so that it's easier to review.

[1]: EWMA = Exponentially Weighted Moving Average

@dakrone dakrone added :Search/Search Search-related issues that do not fall into other categories v6.0.0 labels May 31, 2017
@dakrone dakrone requested a review from s1monw May 31, 2017 17:21
Copy link
Member

Choose a reason for hiding this comment

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

Throw out -1s?

Copy link
Member

Choose a reason for hiding this comment

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

Assert that >= 0 unless t != null?

Copy link
Member Author

Choose a reason for hiding this comment

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

Even if t weren't null, the time should be >= 0; I'll add an assert

Copy link
Member

Choose a reason for hiding this comment

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

It might be nice to have a test that starts with 0 and continually adds the same number and asserts that eventually the average comes near enough to the number. Or something that asserts that the changes get smaller with additional data points.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I've added this test, thanks for the suggestion

Copy link
Member

Choose a reason for hiding this comment

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

I'm curious about why you chose this. If you don't have a good reason for that number then maybe leave a comment about how this is just a guess.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's totally a random pick, I'll add a comment. I'm planning on revisiting the number once all the parts are in place (so I can test different values)

Copy link
Member

Choose a reason for hiding this comment

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

Probably worth a comment about why the target is a good starting point.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea, I'll add that

@dakrone
Copy link
Member Author

dakrone commented Jun 2, 2017

Thanks for the comments @nik9000, I pushed commits addressing them!

@dakrone dakrone force-pushed the capture-task-execution-ewma branch from 7faa88d to 1685c38 Compare June 5, 2017 15:20
This is the first step towards adaptive replica selection (elastic#24915). This PR
tracks the execution time, also known as the "service time" of a task in the
threadpool. The `QueueResizingEsThreadPoolExecutor` then stores a moving average
of these task times which can be retrieved from the executor.

Currently there is no functionality using the EWMA yet (other than tests), this
is only a bite-sized building block so that it's easier to review.

[1]: EWMA = Exponentially Weighted Moving Average
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search/Search Search-related issues that do not fall into other categories v6.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants