http: always cork outgoing writes
This PR always corks outgoing writes, no matter whether it's using chunked encoding or has a Content-Length
set. Previously it was only enabled for chunked encoding writes.
Some benchmark results:
improvement confidence p.value
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk" -0.86 % 1.738663e-01
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk" -1.38 % * 1.096846e-02
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=1 len=4 type="buffer" benchmarker="wrk" 4.46 % *** 1.601082e-05
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk" 1662.88 % *** 2.753497e-48
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk" 987.47 % *** 1.450546e-35
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=4 len=4 type="buffer" benchmarker="wrk" 1691.00 % *** 1.523719e-50
The single chunk write results here that are < 0% will be even less of a problem once the nextTick performance improvements in https://github.com/nodejs/node/pull/13446 land:
improvement confidence p.value
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=1 len=1024 type="buffer" benchmarker="wrk" 0.62 % 2.106693e-01
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=1 len=102400 type="buffer" benchmarker="wrk" -1.11 % 5.027460e-02
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=1 len=4 type="buffer" benchmarker="wrk" 5.28 % *** 1.522987e-05
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=4 len=1024 type="buffer" benchmarker="wrk" 1679.19 % *** 1.692272e-53
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=4 len=102400 type="buffer" benchmarker="wrk" 1010.63 % *** 1.096472e-38
http/simple.js res="normal" chunkedEnc="false" c=50 chunks=4 len=4 type="buffer" benchmarker="wrk" 1703.22 % *** 1.768577e-51
CI: https://ci.nodejs.org/job/node-test-pull-request/8532/
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
- http