Skip to content

Blacklist workers if they fail for too many times - #3643

Merged
nishantmonu51 merged 6 commits into
apache:masterfrom
niketh:blacklist-workers
Nov 29, 2016
Merged

nishantmonu51 merged 6 commits into
apache:masterfrom
niketh:blacklist-workers

Conversation

@niketh

@niketh niketh commented Nov 1, 2016 •

Copy link
Copy Markdown
Contributor
  1. Blacklisting Workers if the tasks have failed continuously for the last 'n' times that can be specified by maxRetriesBeforeBlacklist
  2. Added a cleanup period that will remove blacklisted nodes after a certain period taskBlackListCleanupPeriod
  3. Once node is blacklisted it only remains blacklisted for a period taskBlackListBackoffTimeMillis

@niketh
niketh force-pushed the blacklist-workers branch 2 times, most recently from 70d1639 to 4b744ef Compare November 1, 2016 20:33
@niketh niketh closed this Nov 1, 2016
@niketh niketh reopened this Nov 1, 2016
@niketh
niketh force-pushed the blacklist-workers branch from 4b744ef to 97f0f72 Compare November 1, 2016 21:15

public Collection<ImmutableWorkerInfo> getBlackListedWorkers()
{
return ImmutableList.copyOf(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Collections.unmodifiableSet() should be good enough.

@cheddar

cheddar commented Nov 2, 2016

Copy link
Copy Markdown
Contributor

👍 on the code changes

I hit "approve", but then realized we should add documentation for the new parameters. So, that should be done.


@JsonProperty
@Min(60000)
private long taskBlackListBackoffTimeMillis = 900000;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we switch this to a Period?

Comment thread docs/content/design/indexing-service.md Outdated
```

#### Blacklisted Workers
If the workers fail tasks above a threshold, the overlord will blacklist these workers. No more than 20% of the nodes can be blacklisted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we reference one of the config parameters here to make it a bit easier to track down the set of params on the config page (maybe even link to the config page).

@niketh niketh closed this Nov 2, 2016
@niketh niketh reopened this Nov 2, 2016
@niketh
niketh force-pushed the blacklist-workers branch from c704494 to 3936f05 Compare November 2, 2016 21:11
@niketh
niketh force-pushed the blacklist-workers branch from 3936f05 to 0d7ecd2 Compare November 2, 2016 22:41

@nishantmonu51 nishantmonu51 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

left few comments,
In case user has configured autoscaling, It would also be nice to make autoscaling smarter to replace a blacklisted node, that can be done in a separate PR.

|`druid.indexer.runner.taskShutdownLinkTimeout`|How long to wait on a shutdown request to a middle manager before timing out|PT1M|
|`druid.indexer.runner.pendingTasksRunnerNumThreads`|Number of threads to allocate pending-tasks to workers, must be at least 1.|1|
|`druid.indexer.runner.maxRetriesBeforeBlacklist`|Number of times the middle manager can fail a task, before it gets blacklisted, must be at least 1|5|
|`druid.indexer.runner.taskBlackListBackoffTime`|How long to wait before a task is whitelisted again. This value should be greater that the value set for taskBlackListCleanupPeriod.|PT15M|

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

rename this to workerBlackListBackoffTime & workerBlackListCleanupPeriod and modify docs to make it clear that we are blacklisting workers instead of tasks.

```

#### Blacklisted Workers
If the workers fail tasks above a threshold, the overlord will blacklist these workers. No more than 20% of the nodes can be blacklisted. Blacklisted nodes will be periodically whitelisted.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is max percentage of blacklist workers configurable ?
If not, can we make it configurable ?

// Clean blacklisted workers if blacklisted time has elapsed
if(System.currentTimeMillis() - zkWorker.getLastCompletedTaskTime().getMillis() >
config.getTaskBlackListBackoffTime().toStandardDuration().getMillis()){
// White listing node

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should be an info level log

|`druid.indexer.runner.taskCleanupTimeout`|How long to wait before failing a task after a middle manager is disconnected from Zookeeper.|PT15M|
|`druid.indexer.runner.taskShutdownLinkTimeout`|How long to wait on a shutdown request to a middle manager before timing out|PT1M|
|`druid.indexer.runner.pendingTasksRunnerNumThreads`|Number of threads to allocate pending-tasks to workers, must be at least 1.|1|
|`druid.indexer.runner.maxRetriesBeforeBlacklist`|Number of times the middle manager can fail a task, before it gets blacklisted, must be at least 1|5|

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

mention that only consecutive failures will be considered.


// After backOffTime the nodes are whitelisted
System.out.println("Sleeping for " + timeoutPeriod.toStandardDuration().getMillis());
Thread.sleep(2*timeoutPeriod.toStandardDuration().getMillis());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

minor nit : would be nice if we can avoid sleep, helps in making test more deterministic on slow machines.

@cheddar

cheddar commented Nov 4, 2016

Copy link
Copy Markdown
Contributor

Great comments @nishantmonu51

Niketh is on vacation, so probably won't get to these changes until he is back.

@fjy fjy added this to the 0.9.3 milestone Nov 4, 2016
@fjy fjy added the Improvement label Nov 4, 2016
@niketh

niketh commented Nov 22, 2016

Copy link
Copy Markdown
Contributor Author

@nishantmonu51 @cheddar Thanks for your comments. Made the requested changes.

@cheddar cheddar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think these changes look good. It does look like you weren't able to remove the Thread.sleep from the test, it would be great if you could reply to Nishant's comment explaining why it's hard to remove that though.

@JsonProperty
@Max(100)
@Min(0)
private int maxPercentageBlacklistWorkers = 20;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might I suggest making this a double?

@niketh

niketh commented Nov 23, 2016

Copy link
Copy Markdown
Contributor Author

@cheddar @nishantmonu51 I wasn't able to remove the Thread.sleep, because i wanted to automatic removal of blacklisted workers once a stipulated time elapses. The thread.sleep here is very small

@cheddar

cheddar commented Nov 23, 2016

Copy link
Copy Markdown
Contributor

👍

@nishantmonu51 nishantmonu51 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@nishantmonu51
nishantmonu51 merged commit 2640d17 into apache:master Nov 29, 2016
dgolitsyn pushed a commit to metamx/druid that referenced this pull request Feb 14, 2017
* Blacklist workers if they fail for too many times

* Adding documentation

* Changing to timeout to period and updating docs

* 1. Add configurable maxPercentageBlacklistWorkers
2. Rename variable

* Change maxPercentageBlacklistWorkers to double

* Remove thread.sleep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants