HTTP: which is better: a large timeout or several attempts?

I make HTTP GET requests from mobile devices (so network connectivity is usually not reliable) and wonders what would be better:

  • Try 1 query with a timeout of 60 seconds or
  • Try 3 queries each with a timeout of 20 seconds

Or any other combination of attempts / timeouts. I do not know if the HTTP / TCP connection can really be stopped, so retrying will be good. I do not transmit a lot of data (<1 kB) and wonders, which approach usually gives a faster response time?

+4
source share
1 answer

As long as this is an idempotent operation, it should be good to repeat more often in theory. Honestly, GET should never have any side effect.) It can still load unnecessary load on the server, and deferred responses to multiple retransmissions of the request can saturate the downlink and make the situation worse.

In interactive applications, I find an honest notification “it will take longer than usual” when the user’s “try again” is better: the user has the option to click the “try again” button after leaving the tunnel or building, which causes a short network outage.

Conversely, in a forest with constantly low bandwidth, they will learn to ignore the notification and wait patiently.

0
source

All Articles