Project

General

Profile

Actions

Feature #64083

open
HN

Response code from rgw rate-limit should be 429 not 503 , best is configurable

Feature #64083: Response code from rgw rate-limit should be 429 not 503 , best is configurable

Added by hoan nv almost 3 years ago. Updated 8 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
Reviewed:
Affected Versions:
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

My cluster in 17.2.6 version.

I use rate-limit features https://docs.ceph.com/en/quincy/radosgw/admin/#rate-limit-management

After set rate limit for some user.

I see haproxy logs will see logs 503 status and rgw logs sometime like that

{"bucket":"veeam-test","time":"2024-01-15T22:23:35.975848Z","time_local":"2024-01-15T22:23:35.975848+0000","remote_addr":"171.244.32.2","user":"test","operation":"put_obj","uri":"PUT /veeam-test/Veeam/Archive/veeam-116/ae1cb961-764c-46ae-aef3-ba0668dfa008/a79fe84c-1cd3-44a2-a8b2-125e73026d0b/blocks/4113564ad3ca58f60d64e45d7c1f51ac/154616.6a4eb5930f72b2e1a75d43a34cca03f7.00000000000000000000000000000000.blk HTTP/1.1","http_status":"503","error_code":"SlowDown","bytes_sent":231,"bytes_received":0,"object_size":0,"total_time":1,"user_agent":"APN/1.0 Veeam/1.0 Backup/11.0","referrer":"","http_x_headers":[{"HTTP_CONTENT_MD5":"IK/uASkXx8yIDwmQtl0ZcQ=="},{"HTTP_X_FORWARDED_FOR":"171.244.32.2"}],"trans_id":"tx000008b76ec0eab2e0249-0065a5b067-1c21258-sgn10-1","authentication_type":"Local","access_key_id":"xxxxx","temp_url":false}

Status 429 will be match response code from rate-limit :

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429

I think this config should be configurable like :

rgw_rate_limit_response_status = 429

Thanks.

WD Updated by Wes Dillingham over 2 years ago Actions #1

+1 on this request

LS Updated by Lumir Sliva 8 months ago Actions #2

This has been open for a while so wanted to share a proposed approach before submitting a PR.

AWS S3 returns `503 SlowDown` for throttled requests, and as cbodley noted on PR #66222, that's the more correct mapping for S3 compatibility. Changing the default to 429 would break that.

The current docs don't mention the response behavior at all — operators have no guidance on what status code clients receive, how to configure load balancers to handle it, or what retry strategy clients should use. That alone causes confusion (as this issue shows).

Proposed approach (likely split across 2-3 PRs):

- Doc update (standalone): Document that rate-limited requests return `503 SlowDown`, explain the load balancer implications, and add guidance for configuring HAProxy/nginx to distinguish rate-limit 503s from actual backend failures (e.g. matching on the `SlowDown` error code in the response body, or using the `Retry-After` header once available)
- Retry-After header + response delay: Add a `Retry-After` header to all rate-limited responses (value = `rgw_ratelimit_interval`). Add `rgw_ratelimit_response_delay_ms` to introduce an async delay before sending the error, mitigating retry storms from clients that ignore the error code (tracker #67655 — observed with aws-sdk-go/Loki)
- Configurable HTTP status: Add `rgw_ratelimit_http_status` so operators can override to 429 where needed. Default stays 503 for S3 compatibility

The doc update and Retry-After header are useful regardless of whether the configurable status lands. Happy to put up PRs if this direction looks reasonable.

Actions

Also available in: PDF Atom