Yes, port numbers are a different system resource, which in some cases is more 
valuable than memory or connection closure time.

In memory constrained and slow systems, like embedded devices, saving a 
fraction of a second on resource releases (or several hundred milliseconds on 
slow devices)
may be a very important benefit, which will overweigh potential delays in port 
reuses.

That's why I suggested to have an option which would sacrifice faster port 
reuse but will allow to get faster connection resource release.

Thanks,
Dmitry Karpov


-----Original Message-----
From: curl-library <curl-library-boun...@lists.haxx.se> On Behalf Of Dan 
Fandrich via curl-library
Sent: Thursday, June 27, 2024 12:14 PM
To: curl-library@lists.haxx.se
Cc: Dan Fandrich <d...@coneharvesters.com>
Subject: [EXTERNAL] Re: graceful shutdowns coming in 8.9.0

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
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to