2

Requests to a CouchDB instance on the same machine have about 40ms latency when HTTP keepalive is used by the client, about 0-1ms latency when the client does not use keepalive. What causes this latency?

thejh
  • 141
  • 2

1 Answers1

2

This is caused by Nagle's algorithm. CouchDB sends the HTTP headers and the response body in separate calls, causing the kernel to not deliver the response body for 40ms.

As a workaround, you can use this LD_PRELOAD shim to completely turn off Nagle's algorithm for the database process.

thejh
  • 141
  • 2