Skip to content

tcp 2.0.2: TCP_NODELAY by default, peer_closed()

Choose a tag to compare

@Mosaad-M Mosaad-M released this 08 Oct 13:00
· 4 commits to master since this release
236b88b

Small follow-ups to 2.0.1. No breaking change.

Changes

  • TCP_NODELAY by default. Pass connect(..., nodelay=False) to opt out. Measured on Linux (loopback), a request sent in 5 small writes to a server that replies once per request took 56 µs with TCP_NODELAY and 40.6 ms without, because of the delayed-ACK stall. PostgreSQL's extended query and HTTP both follow that pattern, so pg's exec_params loses a 40 ms stall per query on Linux. macOS showed no stall either way. The README also covers the opposite case, a peer that answers every segment with its own small write.
  • peer_closed(): a non-blocking check that the peer hasn't closed the connection, for reusing pooled sockets.
  • Docs: the README now states that DNS resolution isn't covered by timeout_secs.

Testing

  • 30 tests on Linux and macOS.
  • requests, websocket and pg suites pass with this version.
  • tls live sweep: 24 sites plus 4 bad endpoints, all correct. 55-site sweep: 54 of 55 (www.netflix.com fails with every tcp version).