-
Notifications
You must be signed in to change notification settings - Fork 20
feat: retrieval-timeout & max-concurrent-requests #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Include fix from ipfs/boxo@e109608
I'll be fixing conformance failures in ipfs/boxo#994 – they are not related to feature added here, but existing bugs that now are surfaced by time-bound execution.
|
applies fix from ipfs/boxo@a51f1fc
docs/environment-variables.md
Outdated
|
||
Maximum number of concurrent HTTP requests that the gateway will process. | ||
|
||
This setting provides rate limiting to protect the gateway from resource exhaustion during high load scenarios. When the limit is reached, new requests will receive a `429 Too Many Requests` response with a `Retry-After` header indicating when the client should retry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And when should that retry be? Is it hardcoded or dynamic or...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hsanjuan for now Retry-After
header is hardcoded to 60 seconds. Pushed 789b053 to document that.
Making this dynamic would make ipfs/boxo#994 even more complex and wanted to avoid that for now.
We can make it configurable in the future PRs but my experience has been clients either detect header and have own smart backoff (using 60s value as initial hint only), or just ignore the header so for MVP static 1m should be ok.
Co-authored-by: Andrew Gillis <11790789+gammazero@users.noreply.github.com>
This PR adds built-in limiters for IPFS Gateway requests:
retrieval-timeout
(default: 30s) andmax-concurrent-requests
(default: 1024).Gateway.RetrievalTimeout|MaxConcurrentRequests
kubo#10905On
ipfs.io
cc @gammazero @hsanjuan @ns4plabs for visibility as this PR moves some of Nginx responsibilities to Rainbow.
High load infrastructure like
ipfs.io
will need to ensure Nginx limits are bit higher than Rainbow, namely:proxy_read_timeout
(nginx) >RAINBOW_RETRIEVAL_TIMEOUT
here (right now both 30s, we need to set proxy +5s)worker_connections
(nginx) >RAINBOW_MAX_CONCURRENT_REQUESTS
(1024 needs to be raised, fysa ipfs.io uses value 10x bigger)We can disable limits by setting both env variables to
0