我开发了一个服务,让自定义限速不再那么痛苦。

1作者: 0megion8 个月前
每次开发 API,我都会遇到同样的难题:速率限制。<p>内置的方案要么过于死板(对所有内容都采用相同的限制),要么过于粗糙,或者在负载过高时崩溃。我真正需要的是类似这样的功能:<p>“限制每个用户 ID 的请求数量”<p>“限制每个 API 密钥的请求数量”<p>甚至“根据自定义字段(如订阅计划)进行限制”<p>我最终不止一次地写出了自己的意大利面条代码……而且我讨厌它<p>所以我构建了 Rately。它是一个服务(运行在 Cloudflare 之上),允许你根据自己的需要设置自定义限制,延迟约为 25 毫秒。它的理念是:直接部署,配置你的规则,然后忘掉它。<p>如果你正在运营 SaaS 或 API,我很想知道——你现在是如何处理速率限制的?你是自己构建的还是使用了现成的方案?<p>(如果你感兴趣,请访问:rately.dev)
查看原文
Every time I’ve worked on an API, I ran into the same headache: rate limiting.<p>The built-in stuff was either way too rigid (limit everything the same), too hacky, or it fell over under load. What I actually needed was something like:<p>“Limit requests per user ID”<p>“Limit per API key”<p>Or even “limit based on custom fields like subscription plan”<p>I ended up writing my own spaghetti code more than once… and hated it<p>So I built Rately. It’s a service (runs on top of Cloudflare) that lets you set custom limits however you want, with ~25ms latency. The idea is: drop it in, configure your rules, and forget about it.<p>If you’re running a SaaS or an API, I’d love to hear — how are you handling rate limiting today? Did you build your own or use something off the shelf?<p>(If you’re curious, it’s here: rately.dev)