[PATCH 2 of 3] Upstream: allow recovery from "429 Too Many Requests" response
Maxim Dounin
mdounin at mdounin.ru
Wed Mar 1 15:33:27 UTC 2017
Hello!
On Tue, Feb 28, 2017 at 03:40:00PM -0800, Piotr Sikora via nginx-devel wrote:
> # HG changeset patch
> # User Piotr Sikora <piotrsikora at google.com>
> # Date 1488324535 28800
> # Tue Feb 28 15:28:55 2017 -0800
> # Node ID e21f12a958010e1f3e5cdc1640859e335e032ca5
> # Parent 9a63d6e990d230db0ec6b03250265447f648526e
> Upstream: allow recovery from "429 Too Many Requests" response.
>
> This change adds "http_429" parameter to "proxy_next_upstream" for
> retrying rate-limited requests, and to "proxy_cache_use_stale" for
> serving stale cached responses after being rate-limited.
>
> Signed-off-by: Piotr Sikora <piotrsikora at google.com>
[...]
> @@ -4115,7 +4116,8 @@ ngx_http_upstream_next(ngx_http_request_
> if (u->peer.sockaddr) {
>
> if (ft_type == NGX_HTTP_UPSTREAM_FT_HTTP_403
> - || ft_type == NGX_HTTP_UPSTREAM_FT_HTTP_404)
> + || ft_type == NGX_HTTP_UPSTREAM_FT_HTTP_404
> + || ft_type == NGX_HTTP_UPSTREAM_FT_HTTP_429)
> {
> state = NGX_PEER_NEXT;
>
Not sure it's good idea to don't count a 429 response as a peer
failure. Contrary, counting it as a failure will naturally reduce
load on the particular server, resulting in less rejects.
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list