diff options
author | Ivan Zhakov <ivan@apache.org> | 2019-09-14 10:00:01 +0000 |
---|---|---|
committer | Ivan Zhakov <ivan@apache.org> | 2019-09-14 10:00:01 +0000 |
commit | 68f24602fe9be11c0e7c2ec5b4e02833c93f93aa (patch) | |
tree | a015a08a4e8270ee4fe75f5699a14af07b2571d0 /network_io | |
parent | d9e0d024df1501868a5986525669432e8b50c638 (diff) | |
download | apr-68f24602fe9be11c0e7c2ec5b4e02833c93f93aa.tar.gz |
win32: Use TF_USE_KERNEL_APC for TransmitFile(). According to the
documentation [1] TF_USE_KERNEL_APC is the most performant option:
[[[
Directs the driver to use kernel asynchronous procedure calls (APCs)
instead of worker threads to process long TransmitFile requests.
Long TransmitFile requests are defined as requests that require more
than a single read from the file or a cache; the request therefore
depends on the size of the file and the specified length of the send
packet.
Use of TF_USE_KERNEL_APC can deliver significant performance benefits.
It is possible (though unlikely), however, that the thread in which
context TransmitFile is initiated is being used for heavy computations;
this situation may prevent APCs from launching.
]]]
The downside is not applicable for our use case since calling thread
is not busy and waiting for operation completion.
[1] https://docs.microsoft.com/en-gb/windows/win32/api/mswsock/nf-mswsock-transmitfile
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1866934 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io')
-rw-r--r-- | network_io/win32/sendrecv.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/network_io/win32/sendrecv.c b/network_io/win32/sendrecv.c index 21779082d..a841d222d 100644 --- a/network_io/win32/sendrecv.c +++ b/network_io/win32/sendrecv.c @@ -293,6 +293,28 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, bytes_to_send = *len; *len = 0; + /* According to the documentation [1] TF_USE_KERNEL_APC is the most performant option: + * [[[ + * Directs the driver to use kernel asynchronous procedure calls (APCs) + * instead of worker threads to process long TransmitFile requests. + * Long TransmitFile requests are defined as requests that require more + * than a single read from the file or a cache; the request therefore + * depends on the size of the file and the specified length of the send + * packet. + * + * Use of TF_USE_KERNEL_APC can deliver significant performance benefits. + * It is possible (though unlikely), however, that the thread in which + * context TransmitFile is initiated is being used for heavy computations; + * this situation may prevent APCs from launching. + * ]]] + * + * The downside is not applicable for our use case since calling thread + * is not busy and waiting for operation completion. + * + * [1] https://docs.microsoft.com/en-gb/windows/win32/api/mswsock/nf-mswsock-transmitfile + */ + dwFlags |= TF_USE_KERNEL_APC; + /* Handle the goofy case of sending headers/trailers and a zero byte file */ if (!bytes_to_send && hdtr) { if (hdtr->numheaders) { |