This question is about trying to find a scientifically or statistically defensible rationale for choosing a timeout. I mean every app must do this, but what is the optimal timeout? We need more people to answer or comment. +3, +4 does not mean the question is solved. An important question deserves more answers. We can all benefit from this knowledge.
Basically trying to compare:
a short timeout of say 20 seconds, but two connection attempts are made
vs
one long connection attempt of say 40 or 60 seconds.
Which has the best chance of establishing a connection? We need hard facts. So far the numbers I am getting are all over the place 10s, 42, 60s. But what is really optimal?
Now of course after 5-10 seconds the user should be informed of a problem either way, but whats the best effort approach for establishing a connection.
Note: I am aware that there are many factors, but as app developers we can't always get permission to examine wifi signal situation etc. Still there must be some rational answer of what is best on average.
Connect Timeout Meaning, in general, that you cannot contact the service. Setting a low connect timeout, like 2 seconds, might be useful to prevent your application (worker, job, etc.) to remain “blocked” for a long time, as the server probably has a problem.
Generally 1 Second is considered acceptable. The reason for this and why the suggested numbers vary so much is most APIs have a lockout if you send requests to fast. However, some APIs will let you send requests faster.
Network timeout is an option that lets you decide how long you are willing to wait for an operation in a Workstation client before your request for that operation is canceled (timed out) on a network.
You will hopefully get better answers, but from personal experience I can talk about the user side of things. If I open an app that requires a data connection, such as my web browser or a social client, I want it to timeout in under 5 seconds, because it shouldn't take a long time to determine if I actually have a connection or not.
It is possible to look at it from a device standpoint, but that's highly variable (wifi vs. 3G, specific network chip, OS, data connection currently active, etc.) whereas user requirement are probably the most important factor. You could get away with like 30 seconds if the data connection isn't necessarily critical for the application, but the major point is that the technological limitation is only a part of how long you should budget for a connection timeout.
I always put ten seconds as a maximum, although that is a personal preference. Think about if you're holding your phone for five seconds and waiting for information to appear. I would already be frustrated - thus adding the double value seems appropriate. If there is a problem I would like to know about it via a Toast
, footer view or something else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With