When uploading files, we use overlapped I/O for reading from the file, in the FileStream / FileStreamContext classes. I don't suppose anyone knows if there are, experimentally, any significant performance benefits from using overlapped I/O?Context: I'm working on adding file upload support to the network service. Since the network service will be sandboxed, we need to pass in file handles. Currently, one can safely reuse the content::ResourceRequest structure (Say, to retry, or if you make a request, it redirects, and you want to significantly modify the redirected request, you can modify the request and use it again). Conveniently, there is an API to duplicate file handles on all platforms! So...problem solved, right? Except on Windows, we use CreateIoCompletionPort to listen to file handles in the network process. This can, apparently, only be used once per file handle. Even if we call DuplicateFileHandle on a handle for which we've never called this method, calling CreateIoCompletionPort on two different handles duplicated from the original handle fails.
So we either need to impose a restriction that a content::ResourceRequest with a file handle can never be duplicate, switch to sync IO on Windows (We use standard sync IO on other platforms here, anyways), or look for an alternative solution.We could switch to sync IO but also add an extra layer of buffering, but that introduces more copies, unless we rework the UploadDataStream API, so may not be a good idea.
--
You received this message because you are subscribed to the Google Groups "network-service-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to network-service-dev+unsub...@chromium.org.
To post to this group, send email to network-service-dev@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/network-service-dev/CAEK7mvqgF9Ep40QVD7PHQHH%2B%2BPxq1ooRm%2BSizZHfe_6R9Fq_uA%40mail.gmail.com.
Sorry I don't have any concrete data, but it's my experience anecdotally and my understanding in general that overlapped I/O is quite a bit more efficient than its alternatives on Windows. That is relatively old information, so it's possible something has changed and it's not as significant now. It's also possible that efficiency isn't critical for something like file upload.
+robliao for Windows expertise/advice.
On Thu, Nov 30, 2017 at 9:12 AM, 'Matt Menke' via network-service-dev <network-service-dev@chromium.org> wrote:When uploading files, we use overlapped I/O for reading from the file, in the FileStream / FileStreamContext classes. I don't suppose anyone knows if there are, experimentally, any significant performance benefits from using overlapped I/O?Context: I'm working on adding file upload support to the network service. Since the network service will be sandboxed, we need to pass in file handles. Currently, one can safely reuse the content::ResourceRequest structure (Say, to retry, or if you make a request, it redirects, and you want to significantly modify the redirected request, you can modify the request and use it again). Conveniently, there is an API to duplicate file handles on all platforms! So...problem solved, right? Except on Windows, we use CreateIoCompletionPort to listen to file handles in the network process. This can, apparently, only be used once per file handle. Even if we call DuplicateFileHandle on a handle for which we've never called this method, calling CreateIoCompletionPort on two different handles duplicated from the original handle fails.Yeah, you get one IOCP per object regardless of how many handles the object has referencing it; and once an object is associated with an IOCP, that IOCP exists until said object is destroyed (i.e. all its handles closed). I assume this was done to strike a balance between simplicity and efficiency in the API, but it sure is unfortunate.So we either need to impose a restriction that a content::ResourceRequest with a file handle can never be duplicate, switch to sync IO on Windows (We use standard sync IO on other platforms here, anyways), or look for an alternative solution.We could switch to sync IO but also add an extra layer of buffering, but that introduces more copies, unless we rework the UploadDataStream API, so may not be a good idea.
--
You received this message because you are subscribed to the Google Groups "network-service-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to network-service-dev+unsubscribe...@chromium.org.
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+unsubscribe@chromium.org.
To post to this group, send email to net...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/CAK7A45XhdrPv%3D2nLi-6gYNOcRASF28r74og1G6LeysjGB0OpAw%40mail.gmail.com.
Well, we have Async IO, non-blocking I/O, and blocking I/O.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/CAEK7mvqfTetAjf9O5gawuDE3e6o4aZoBndNEya47%2Bs_TR_psWA%40mail.gmail.com.