Skip to content
This repository
Browse code

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...
commit dc559a5ce69cef28e1c73a3782c17b5801989e67 1 parent b86ed94
Ben Noordhuis bnoordhuis authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  src/unix/tcp.c
2  src/unix/tcp.c
@@ -233,7 +233,7 @@ int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) {
233 233
234 234 if (single_accept == -1) {
235 235 const char* val = getenv("UV_TCP_SINGLE_ACCEPT");
236   - single_accept = (val == NULL) || (atoi(val) != 0); /* on by default */
  236 + single_accept = (val != NULL && atoi(val) != 0); /* Off by default. */
237 237 }
238 238
239 239 if (single_accept)

0 comments on commit dc559a5

Please sign in to comment.
Something went wrong with that request. Please try again.