On Sun, 10 Jan 2021, Midnight Wonderer wrote:

- Users expect the timeout to expire after the given time, so if the host has
N addresses, they still don't want the timeout to be multiplied with N.

This is true if we are talking about "timeout", which should refer to the timeout as a whole. But we are talking about "connection timeout" here, most people would assume it is per connection.

Then you know more about most curl users than I do.

However, we are setting the connection timeout, mostly, because we don't want to waste more time on a hopeless connection.

Correct. You typically don't know how many addresses a host name resolves to, and these days it isn't even unusual 20 addresses.

Users I've talked to want an option that works like this:

 - "I want to connect to the server within 10 seconds or give up"

*The server* or even "the URL". That's a single unity and there's a single timeout value, given in a time unit.

They very rarely say:

- "I want to attempt to connect to each address of the host name for 10 seconds each before we give up, which can take anywhere from 10 to 200 or more seconds"

So what does nginx do when the first IP address just silently drops all TCP
packets? Fail the connection after one second even if there are also 9 working
IP addresses?

It will try the next one.

So a 10 second timeout can legitimately take 200 seconds before it expires. That surely will surprise some users.

But sure, that's just a decision taken in the opposite way we did.

So the connection timeout is per connection.

It wouldn't strictly be "per connection" though since no connection could be established.

It could be per *connection attempt* and it probably makes IPv4 and IPv6 connection attempts in parallel, happy eyeballs style.

--

 / daniel.haxx.se
 | Commercial curl support up to 24x7 is available!
 | Private help, bug fixes, support, ports, new features
 | https://www.wolfssl.com/contact/
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to