-
Notifications
You must be signed in to change notification settings - Fork 68
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
Add concurrency to the memberlist transport's WriteTo
method
#525
Conversation
3d073ca
to
183d576
Compare
9b48111
to
1807e0c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't make WriteTo non-blocking -- only increases concurrency, but when all write goroutines are used, blocking will still occur. We should clarify that.
I considered giving it a buffered channel which would push back the blocking part. It would still be blocking to a point An unlimited amount of goroutines could cause unexpected problems |
Yes, I think the only safe way to make it non-blocking would be to drop a packet if workers are busy and buffer is full (when used). Having unbounded number of goroutines or unlimited buffer could lead to memory exhaustion. |
WriteTo
method
WriteTo
methodWriteTo
method
I've instead renamed the PR and changelog. While, semantically, it doesn't really make it non-blocking, it does resolve the core issue which #192 was meant to solve, would you agree? |
55cb80a
to
b950353
Compare
b950353
to
a01997d
Compare
/find-flaky-tests |
a01997d
to
9155c11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing my feedback.
3427e65
to
452abc0
Compare
- Create goroutines and keep them while the TCPTransport is alive. End them on the `Shutdown` function - Add `TestTCPTransportWriteToUnreachableAddr` test to check that writing is not blocking anymore (without this PR, it takes `writeCt * timeout` to run and it fails)
- Rename CHANGELOG - Mutex lock on shutdown rather than write - Wait when workers are ended rather than for each write
- Move variables around - Add timeout before dropping requests. This prevents blocking on the `WriteTo` function
452abc0
to
ecd4853
Compare
What this PR does:
This PR adds concurrency to the WriteTo function with a configurable maximum writes parameter to control the number of goroutines.
This allows the memberlist to keep working if one of the addresses it's trying to write to is unreachable
Which issue(s) this PR fixes:
Fixes #192
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]