datalust / seq-logging

A Node.js client for the Seq HTTP ingestion API
Apache License 2.0
25 stars 15 forks source link

TCP connection is closed and sockets are not reused #35

Closed alonrks closed 3 years ago

alonrks commented 3 years ago

Hi, we are using pino and pino-seq library. Performance tests show that opening and closing TCP connections impacts server performance negatively in 2 ways:

  1. Unnecessary CPU overhead.
  2. Diminishes available TCP ports for the server (connections closed are not available to the OS immediately).

Do you plan to allow via configuration to keep sockets around even when there are no outstanding requests, so they can be used for future requests without having to reestablish a TCP connection like creating a custom http.Agent with keepAlive and other required options? Currently it sets HTTP header Connection to close.

nblumhardt commented 3 years ago

Thanks for the feedback, @alonrks!

We don't have any plans to work on this in the immediate future, but we agree that it's a reasonable and worthwhile thing to add.

If you're interested (or anyone following along is interested?) in sketching this out and sending a PR, we'd be happy to get stuck in and review/merge/release it.

KodrAus commented 3 years ago

Hey @alonrks :wave: We've just merged in #37 (thanks @conorbros :tada:) that uses http.Agent in Node to re-use connections across batches.