You may have to resort to Lua (openresty) and periodically perform via a sub request a query which should indicate how fast an upstream is and decide weather to take it offline (which also can be done with Lua). Posted at Nginx Forum: https://forum.nginx.org/read.php?2,280259,280260#msg-280260