curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

Re: graceful shutdowns coming in 8.9.0

From: Dan Fandrich via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 27 Jun 2024 12:13:59 -0700

On Thu, Jun 27, 2024 at 06:44:14PM +0000, Dmitry Karpov via curl-library wrote:
> It would be nice to have an option to abort connections and close their sockets even in cases when transfer(s) were completed successfully,
> but connections must go away by some reason (i.e. too old, too many etc).
>
> The graceful shutdown may take some time, and during that period connection resources (i.e. socket buffers, SSL contexts etc) will be held until it is done.
> For resource limited systems, it may be critical to release resources for expired connections as soon as possible and use them for something else (i.e. fresh connections).

One of the benefits of this change is actually to *free* some resources that
weren't before, specifically TCP ports. When a socket is closed uncleanly the
network stack can prevent reuse of that port until a long timeout passes, which
can be an issue on some systems doing hundreds or thousands of connections a
second to a low number of servers, which can use up all their ephemeral ports
and stop communication altogether. So, this change trades off saving one set
of resources for another, but in most cases the graceful shutdown should take a
fraction of a second so those resources shouldn't be needed for much longer
than before. Hopefully, it's a net benefit, but it will be interesting to get
some real-world results.

Dan
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2024-06-27