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

Fix the worker concurrency model #126

Merged
merged 1 commit into from
Sep 7, 2020
Merged

Conversation

rakyll
Copy link
Member

@rakyll rakyll commented Sep 7, 2020

Limit the number of concurrent workers by starting a fixed number of goroutines and providing work by an input channel.

Fixes #123

Limit the number of concurrent workers by starting a fixed number of goroutines and providing work by an input channel.

Fixes google#123
Copy link
Collaborator

@tklauser tklauser left a comment

Choose a reason for hiding this comment

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

Thanks!

@rakyll rakyll merged commit c915060 into google:master Sep 7, 2020
@rakyll rakyll deleted the concurrencylimit branch September 7, 2020 21:23
@rakyll
Copy link
Member Author

rakyll commented Sep 7, 2020

Thanks for the quick review!

@malisetti
Copy link

channel output does not have to be buffered of len of all the processes. #128 fixes this.

@tklauser tklauser mentioned this pull request Sep 8, 2020
yarcat added a commit to yarcat/gops that referenced this pull request Sep 9, 2020
This solution is a bit more idiomatic and resonates with "Don't communicate by
sharing memory, share memory by communicating." Go proverb [^1].

Similar approach to use buffered channel as a semaphore to limit throughput is
discussed in Effective Go [^2].

[^1]: https://go-proverbs.github.io/
[^2]: https://golang.org/doc/effective_go.html#channels
yarcat added a commit to yarcat/gops that referenced this pull request Sep 9, 2020
This solution is a bit more idiomatic and resonates with "Don't communicate by
sharing memory, share memory by communicating." Go proverb [^1].

Similar approach to use buffered channel as a semaphore to limit throughput is
discussed in Effective Go [^2].

[^1]: https://go-proverbs.github.io/
[^2]: https://golang.org/doc/effective_go.html#channels
yarcat added a commit to yarcat/gops that referenced this pull request Sep 10, 2020
This solution is a bit more idiomatic and resonates with "Don't communicate by
sharing memory, share memory by communicating." Go proverb[^1].

Similar approach to use buffered channel as a semaphore to limit throughput is
discussed in Effective Go[^2].

[^1]: https://go-proverbs.github.io/
[^2]: https://golang.org/doc/effective_go.html#channels
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.

Gops hangs if there are too many Go processes to examine
3 participants