agido-malter / logback-elasticsearch-appender

Logback Elasticsearch Appender
Other
23 stars 11 forks source link

More efficient not to disconnect urlConnection in ElasticSearchWriter #22

Closed inigo closed 7 months ago

inigo commented 11 months ago

Disconnecting a urlConnection "Indicates that other requests to the server are unlikely in the near future" (from the JDK docs).

It closes the underlying socket, so it can't be reused for subsequent connections. In an app like this, where there are repeated connections to the same server, it's more efficient to keep the socket open so other urlConnections can use it. There's various discussion of this - a reasonably good article is at https://dzone.com/articles/caveats-httpurlconnection.

This affects ElasticsearchWriter#95

I've got a PR that implements this against a separate fork at https://github.com/67Bricks/logback-elasticsearch-appender/pull/2, but that may well clash with other changes that you've made, so I'll see if I can recreate it against this fork if you like?

danslavetskiy commented 7 months ago

Hi @inigo we also detected the same issue, PR would be appreciated :)