From 806c07ddd507985388fca02f2b3ff4862e6c1b03 Mon Sep 17 00:00:00 2001 From: Alexander Marshalov <_@marshalov.org> Date: Wed, 24 Jan 2024 17:55:06 +0100 Subject: [PATCH] vmsingle/vmselect returns http status 429 (TooManyRequests) instead of 503 (ServiceUnavailable) when max concurrent requests limit is reached. (#5682) --- app/vmselect/main.go | 3 ++- docs/CHANGELOG.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/vmselect/main.go b/app/vmselect/main.go index e9d66d29a..1857f3d80 100644 --- a/app/vmselect/main.go +++ b/app/vmselect/main.go @@ -149,8 +149,9 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool { "are executed. Possible solutions: to reduce query load; to add more compute resources to the server; "+ "to increase -search.maxQueueDuration=%s; to increase -search.maxQueryDuration; to increase -search.maxConcurrentRequests", d.Seconds(), *maxConcurrentRequests, maxQueueDuration), - StatusCode: http.StatusServiceUnavailable, + StatusCode: http.StatusTooManyRequests, } + w.Header().Add("Retry-After", "10") httpserver.Errorf(w, r, "%s", err) return true } diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 78b19c4f3..c7f074620 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -85,6 +85,7 @@ The sandbox cluster installation is running under the constant load generated by * BUGFIX: all: fix potential panic during components shutdown when [metrics push](https://docs.victoriametrics.com/#push-metrics) is configured. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5548). Thanks to @zhdd99 for the [pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5549). * BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly process queries with too big lookbehind window such as `foo[100y]`. Previously, such queries could return empty responses even if `foo` is present in database. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5553). * BUGFIX: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): properly handle possible negative results caused by float operations precision error in rollup functions like rate() or increase(). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5571). +* BUGFIX: `vmselect`: vmsingle/vmselect returns http status 429 (TooManyRequests) instead of 503 (ServiceUnavailable) when max concurrent requests limit is reached. ## [v1.96.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.96.0)