X-RateLimit headers on inbound/outbound federation traffic (/inbox)
What feature would you like implemented? (Please give us a brief description of what you'd like.) Extension of Issue #592 (closed) Specifically, I was looking at https://discord.com/developers/docs/topics/rate-limits and I saw something that caught my eye. I wrote about this in a private channel for sharkey's development.
Per-route rate limits exist for many individual endpoints, and may include the HTTP method (GET, POST, PUT, or DELETE). In some cases, per-route limits will be shared across a set of similar endpoints, indicated in the X-RateLimit-Bucket header. It's recommended to use this header as a unique identifier for a rate limit, which will allow you to group shared limits as you encounter them.
This is something I originally brushed off as not being useful to the project, but I thought of some potential use cases. I think an interesting prospect would be adding global scope rate limit headers to /inbox. Extending on this a bit, I am curious if we could utilize a rate limit bucket to categorize certain AP requests. Whether that's going to be making a bucket per actor or what I have not quite figured out.
As a follow up having an outbound rate limiter utilizing an algorithm such as https://en.wikipedia.org/wiki/Leaky_bucket to other instances' giving rate limit headers on /inbox. This will help create sustained throughput instead of how we currently do bursts of traffic immediately until we hit 429 (or another http status code) causing the job to be delayed. Hopefully this will reduce instances getting overloaded by requests.
Why should we add this feature? (Please give us a brief description of why your feature is important.)
It will help mitigate instances DoSing each other, I think that fedi instance software as a whole should have incorporated rate limit headers & handling based off of headers a long time ago.
Version (What version of Sharkey is your instance running? You can find this by clicking your instance's logo at the top left and then clicking instance information.)
woem.men - 2024.5.1 transfem.social - 2024.6.0-transfem kitsunes.club - 2024.6.0-dev and many more.
Instance (What instance of Sharkey are you using?)
too many to list.
Contribution Guidelines By submitting this issue, you agree to follow our Contribution Guidelines
- I agree to follow this project's Contribution Guidelines
- I have searched the issue tracker for similar requests, and this is not a duplicate.