curl / Mailing Lists / curl-library / Single Mail

curl-library

Limit connection reuse to the first 120 seconds

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 15 Apr 2019 22:37:47 +0200 (CEST)

Hi,

I propose we change the connection reuse logic in curl to only ever consider
connections that have been kept in the connection pool for shorter than 120
seconds. Connections that have been kept around for longer than this will
instead get disconnected [1].

The reason is simply that the longer the connection has been idle, the less
likely it is to a) be useful again and b) to actually work to reuse. Avoiding
reuse attempts that have a high risk of failing will improve performance and
behavior.

My PR for this change is here[2]. The max age (120 seconds) in this code is
currently "hardcoded" but I'm sure there might be use cases for changing it,
so I'm open for making it possible to set through the API.

Comments?

[1] = they will get disconnected when "found" by one of the algorithms so they
may in fact be kept around longer than 120 seconds but they will not be reused
if found later.

[2] = https://github.com/curl/curl/pull/3782

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2019-04-15