[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apr-cvs
Subject:    svn commit: r1866934 - /apr/apr/trunk/network_io/win32/sendrecv.c
From:       ivan () apache ! org
Date:       2019-09-14 10:00:01
Message-ID: 20190914100001.B74B93A015F () svn01-us-west ! apache ! org
[Download RAW message or body]

Author: ivan
Date: Sat Sep 14 10:00:01 2019
New Revision: 1866934

URL: http://svn.apache.org/viewvc?rev=1866934&view=rev
Log:
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


Modified:
    apr/apr/trunk/network_io/win32/sendrecv.c

Modified: apr/apr/trunk/network_io/win32/sendrecv.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/network_io/win32/sendrecv.c?rev=1866934&r1=1866933&r2=1866934&view=diff
 ==============================================================================
--- apr/apr/trunk/network_io/win32/sendrecv.c (original)
+++ apr/apr/trunk/network_io/win32/sendrecv.c Sat Sep 14 10:00:01 2019
@@ -293,6 +293,28 @@ APR_DECLARE(apr_status_t) apr_socket_sen
     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) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic