app/vmauth: allow buffering request body before proxying it to the backend

This should help reducing load on backends when many concurrent clients
send requests over slow networks (for example, when many IoT devices send metrics
to vmauth over slow connections).

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10309

This commit is based on top of https://github.com/VictoriaMetrics/VictoriaMetrics/pull/10310
Thanks to @makasim for the initial idea.
This commit is contained in:
Aliaksandr Valialkin
2026-01-26 03:02:30 +01:00
parent ac6d9d632f
commit e31abfc25c
7 changed files with 625 additions and 228 deletions

View File

@@ -617,6 +617,13 @@ func (rwa *responseWriterWithAbort) Flush() {
flusher.Flush()
}
// Unwrap returns the original ResponseWriter wrapped by rwa.
//
// This is needed for the net/http.ResponseController - see https://pkg.go.dev/net/http#NewResponseController
func (rwa *responseWriterWithAbort) Unwrap() http.ResponseWriter {
return rwa.ResponseWriter
}
// abort aborts the client connection associated with rwa.
//
// The last http chunk in the response stream is intentionally written incorrectly,