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

Limit parallelism during garbage collection #2427

Merged
merged 3 commits into from
Mar 14, 2017
Merged

Limit parallelism during garbage collection #2427

merged 3 commits into from
Mar 14, 2017

Conversation

dadgar
Copy link
Contributor

@dadgar dadgar commented Mar 11, 2017

This PR introduces a parallelism limit during garbage collection. This
is used to avoid large resource usage spikes if garbage collecting many
allocations at once.

This PR introduces a parallelism limit during garbage collection. This
is used to avoid large resource usage spikes if garbage collecting many
allocations at once.
client/gc.go Outdated
func (a *AllocGarbageCollector) Stop() {
close(a.shutdownCh)
close(a.destroyCh)
Copy link
Member

Choose a reason for hiding this comment

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

Is this safe to call concurrently with destroyAllocRunner above? I forget whether or not a race could cause a send on a closed chan on line 130 above.

client/gc.go Outdated

select {
case <-a.destroyCh:
default:
Copy link
Member

@schmichael schmichael Mar 14, 2017

Choose a reason for hiding this comment

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

The default case shouldn't be necessary and could make bugs harder to find.


a.destroyAllocRunner(ar)
return nil
}

// CollectAll garbage collects all termianated allocations on a node
func (a *AllocGarbageCollector) CollectAll() error {
Copy link
Member

Choose a reason for hiding this comment

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

[OT] Huh, this method actually never returns an error because all destroying is done async.

Copy link
Member

@schmichael schmichael left a comment

Choose a reason for hiding this comment

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

None of my comments are blockers as long as you're confident closing a chan can safely happen concurrently with sending to it in a select.

@dadgar dadgar merged commit 97a4e13 into master Mar 14, 2017
@dadgar dadgar deleted the f-gc-limit branch March 14, 2017 17:45
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants