Browse files

unix: disable relaxed accept() by default

Don't use the relaxed accept() algorithm introduced in be2a217 unless
explicitly requested. It causes a 50+% performance drop on some node.js
benchmarks:

  $ alias bench='out/Release/node benchmark/http_simple_auto.js \
    -c 10 -n 50000 bytes/1 2>&1 | grep Req'

  $ UV_TCP_SINGLE_ACCEPT=0 bench
  Requests per second:    12331.84 [#/sec] (mean)

  $ UV_TCP_SINGLE_ACCEPT=1 bench
  Requests per second:    3944.63 [#/sec] (mean)
  • Loading branch information...
1 parent b86ed94 commit dc559a5ce69cef28e1c73a3782c17b5801989e67 @bnoordhuis bnoordhuis committed Dec 18, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/unix/tcp.c
View
2 src/unix/tcp.c
@@ -233,7 +233,7 @@ int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) {
if (single_accept == -1) {
const char* val = getenv("UV_TCP_SINGLE_ACCEPT");
- single_accept = (val == NULL) || (atoi(val) != 0); /* on by default */
+ single_accept = (val != NULL && atoi(val) != 0); /* Off by default. */
}
if (single_accept)

0 comments on commit dc559a5

Please sign in to comment.