-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
tcpsocket supports a send buffer #6876
Conversation
Probably also fixes #4508. |
Awesome!! Looks pretty good but I will read it in more detail later. |
would it make sense to make this a feature of all our streams, add generic lock/unlock functions, and utilize them whenever entering/exiting IO-related functions (e.g. print/show)? |
I agree with Jameson. This looks fine to me and I agree that we shouldn't by default buffer just a single |
@vtjnash did you mean all streams (including |
perhaps only This would make IOStream double-buffered, but we could then replace IOStream with uv_file in general and get non-blocking IO for everything (which could potentially make the Pkg manager faster, since it appears to be I/O limited doing a independent operations on metadata for a lot of files). |
Yes, with a buffer on the libuv |
end | ||
end | ||
|
||
make_lockable(s::AsyncStream) = (s.write_lock = RemoteRef()) |
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.
Currently using a RemoteRef
for locking. Wondering if I should change to use libuv mutexes. Local remote refs in workers suffer from the fact that they cannot be initialized till the worker id is known. Also libuv mutexes should be faster and more lightweight.
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.
Just realized that libuv mutexes are recursive and Julia tasks would show up as being part of the same thread. May not be usable.
Have moved the implementation to support all AsyncStreams (except UPDSocket). |
No tidy way to solve #3787 without locks though. With locking (if we decide to export the same), user code could look like
|
Bump. As stated it now supports all AsyncStreams. Feedback? Merging of |
What's the need for having the lock inside the IOStream rather than as a separate thing? |
It is more intuitive to lock a stream and then write multiple times to it. Rather than have user code manage a lock separately. Sort of like Anyways, the lock in the IOStream object is not initialized till |
Bump. Would be great if this could make it into 0.3 |
6c7c7e3
to
1a4c02f
Compare
What is the status here? I get i nice speedup from this on large arrays. See the yellow graph. It shows the time it takes to copy an array of There also seems to be quite a bit of overhead in the |
It is waiting for a review by @JeffBezanson The hump comes about since this optimization does not kick in for arrays less than 1MB in bytesize. The value of const SENDBUF_SZ. I think quite a bit of overhead in
So, a local serialization to a pre-allocated buffer takes 0.13 seconds. If not pre-allocated, it is 0.23 seconds. Again the deserialization/serialization on the remote end will have similar figures. |
Closed in favor of #10073 |
In the same spirit as #6768, this PR avoids a copy while transmitting large arrays between workers. It does this by