Backup servers/ proxy_next_upstream questions

Hello All,
I have a few questions on backup servers and proxy_next_upstream in
general:

For the backup server the doc says: “only uses this server if the
non-backup servers are all down or busy”

  1. So what exactly constitutes down or busy? Is it just response codes
  • 502,503 and 504 or anything else?
  1. Will the same request which received such an error be sent to a
    backup server or is it only subsequent requests?

  2. Can I say 504s happen when proxy_connect_timeout/proxy_read_timeout
    is reached? Is there a way to find out which among these is happening?

  3. Also, In proxy_next_upstream :

error an error has occurred while connecting to the server, sending
a request to it, or reading its response;
timeout occurred timeout during the connection with the server,
transfer the request or while reading response from the server;

I’m not able to clearly distinguish between both of these. What kind
of scenarios explain these?

  1. In a case when proxy_next_upstream is off and when a backup server
    is provided, will nginx still try all non-backup servers before
    sending it to backup servers?

Thanks
Harish