Skip to content

Commit d078859

Browse files
committed
relax rate limits: 100/50/30 RPM tiers at 0/300/500 RPS thresholds
1 parent 4877724 commit d078859

18 files changed

Lines changed: 48 additions & 48 deletions

File tree

deploy/ansible/roles/app/templates/haproxy.cfg.j2

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ frontend http_in
6363
# Track global request rate (per second)
6464
http-request track-sc1 str(global) table global_rate_tracking
6565

66-
# Tier 3: global >= 200 RPS -> limit each IP to 5 RPM
67-
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 200 } { sc_http_req_rate(0) gt 5 }
68-
# Tier 2: global >= 100 RPS -> limit each IP to 10 RPM
69-
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 100 } { sc_http_req_rate(0) gt 10 }
70-
# Tier 1: default -> limit each IP to 30 RPM
71-
http-request deny deny_status 429 if { sc_http_req_rate(0) gt 30 }
66+
# Tier 3: global >= 500 RPS -> limit each IP to 30 RPM
67+
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 500 } { sc_http_req_rate(0) gt 30 }
68+
# Tier 2: global >= 300 RPS -> limit each IP to 50 RPM
69+
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 300 } { sc_http_req_rate(0) gt 50 }
70+
# Tier 1: default -> limit each IP to 100 RPM
71+
http-request deny deny_status 429 if { sc_http_req_rate(0) gt 100 }
7272

7373
# Block /health from external access
7474
acl is_health path /health
@@ -115,12 +115,12 @@ frontend https_in
115115
# Track global request rate (per second)
116116
http-request track-sc1 str(global) table global_rate_tracking
117117

118-
# Tier 3: global >= 200 RPS -> limit each IP to 5 RPM
119-
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 200 } { sc_http_req_rate(0,http_in) gt 5 }
120-
# Tier 2: global >= 100 RPS -> limit each IP to 10 RPM
121-
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 100 } { sc_http_req_rate(0,http_in) gt 10 }
122-
# Tier 1: default -> limit each IP to 30 RPM
123-
http-request deny deny_status 429 if { sc_http_req_rate(0,http_in) gt 30 }
118+
# Tier 3: global >= 500 RPS -> limit each IP to 30 RPM
119+
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 500 } { sc_http_req_rate(0,http_in) gt 30 }
120+
# Tier 2: global >= 300 RPS -> limit each IP to 50 RPM
121+
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 300 } { sc_http_req_rate(0,http_in) gt 50 }
122+
# Tier 1: default -> limit each IP to 100 RPM
123+
http-request deny deny_status 429 if { sc_http_req_rate(0,http_in) gt 100 }
124124

125125
# Block /health from external access
126126
acl is_health path /health

haproxy/haproxy.cfg

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ frontend https_in
4747
# Track global request rate (per second)
4848
http-request track-sc1 str(global) table global_rate_tracking
4949

50-
# Tier 3: global >= 200 RPS -> limit each IP to 5 RPM
51-
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 200 } { sc_http_req_rate(0) gt 5 }
52-
# Tier 2: global >= 100 RPS -> limit each IP to 10 RPM
53-
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 100 } { sc_http_req_rate(0) gt 10 }
54-
# Tier 1: default -> limit each IP to 30 RPM
55-
http-request deny deny_status 429 if { sc_http_req_rate(0) gt 30 }
50+
# Tier 3: global >= 500 RPS -> limit each IP to 30 RPM
51+
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 500 } { sc_http_req_rate(0) gt 30 }
52+
# Tier 2: global >= 300 RPS -> limit each IP to 50 RPM
53+
http-request deny deny_status 429 if { sc_http_req_rate(1,global_rate_tracking) ge 300 } { sc_http_req_rate(0) gt 50 }
54+
# Tier 1: default -> limit each IP to 100 RPM
55+
http-request deny deny_status 429 if { sc_http_req_rate(0) gt 100 }
5656

5757
# Block /health from external access
5858
acl is_health path /health

locales/ar.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ msgstr "أرسل طلبًا إلى نقطة النهاية <code>/json</code>،
8787
msgid "Can I call your service programmatically?"
8888
msgstr "هل يمكنني استدعاء خدمتكم برمجيًا؟"
8989

90-
msgid "Sure, but please respect our rate limits. Normally it's 30 RPM, and under heavy load we may drop it to 10 or 5 RPM."
91-
msgstr "بالتأكيد، لكن يرجى الالتزام بحدود المعدل. عادةً يكون 30 طلبًا في الدقيقة، وتحت الحمل الثقيل قد نخفضه إلى 10 أو 5 طلبات في الدقيقة."
90+
msgid "Sure, but please respect our rate limits. Normally it's 100 RPM, and under heavy load we may drop it to 50 or 30 RPM."
91+
msgstr "بالتأكيد، لكن يرجى الالتزام بحدود المعدل. عادةً يكون 100 طلبًا في الدقيقة، وتحت الحمل الثقيل قد نخفضه إلى 50 أو 30 طلبًا في الدقيقة."
9292

9393
msgid "The API is meant for manual use or small projects. If your site uses our API to look up visitor IPs, please use a message queue so requests don't block. If your project has high traffic or needs low latency, you're better off using our open source offline database: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. That's actually what this project uses under the hood."
9494
msgstr "واجهة برمجة التطبيقات مخصصة للاستخدام اليدوي أو المشاريع الصغيرة. إذا كان موقعك يستخدم واجهة برمجة التطبيقات الخاصة بنا للبحث عن عناوين IP للزوار، يرجى استخدام قائمة انتظار الرسائل حتى لا تتعطل الطلبات. إذا كان مشروعك يتعامل مع حركة مرور عالية أو يحتاج إلى زمن استجابة منخفض، فمن الأفضل استخدام قاعدة بياناتنا المحلية مفتوحة المصدر: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. هذا في الواقع ما يستخدمه هذا المشروع داخليًا."

locales/de.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ msgstr "Senden Sie eine Anfrage an den <code>/json</code>-Endpunkt oder senden S
8787
msgid "Can I call your service programmatically?"
8888
msgstr "Kann ich Ihren Dienst programmatisch aufrufen?"
8989

90-
msgid "Sure, but please respect our rate limits. Normally it's 30 RPM, and under heavy load we may drop it to 10 or 5 RPM."
91-
msgstr "Klar, aber bitte halten Sie unsere Anfragelimits ein. Normalerweise sind es 30 RPM, und bei hoher Last können wir es auf 10 oder 5 RPM reduzieren."
90+
msgid "Sure, but please respect our rate limits. Normally it's 100 RPM, and under heavy load we may drop it to 50 or 30 RPM."
91+
msgstr "Klar, aber bitte halten Sie unsere Anfragelimits ein. Normalerweise sind es 100 RPM, und bei hoher Last können wir es auf 50 oder 30 RPM reduzieren."
9292

9393
msgid "The API is meant for manual use or small projects. If your site uses our API to look up visitor IPs, please use a message queue so requests don't block. If your project has high traffic or needs low latency, you're better off using our open source offline database: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. That's actually what this project uses under the hood."
9494
msgstr "Die API ist für manuelle Nutzung oder kleine Projekte gedacht. Wenn Ihre Website unsere API zur Abfrage von Besucher-IPs verwendet, nutzen Sie bitte eine Nachrichtenwarteschlange, damit Anfragen nicht blockieren. Wenn Ihr Projekt hohen Datenverkehr hat oder niedrige Latenz benötigt, verwenden Sie besser unsere Open-Source-Offline-Datenbank: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. Das ist tatsächlich die Datenbank, die dieses Projekt intern verwendet."

locales/en.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ msgstr "Send a request to the <code>/json</code> endpoint, or send a request wit
8787
msgid "Can I call your service programmatically?"
8888
msgstr "Can I call your service programmatically?"
8989

90-
msgid "Sure, but please respect our rate limits. Normally it's 30 RPM, and under heavy load we may drop it to 10 or 5 RPM."
91-
msgstr "Sure, but please respect our rate limits. Normally it's 30 RPM, and under heavy load we may drop it to 10 or 5 RPM."
90+
msgid "Sure, but please respect our rate limits. Normally it's 100 RPM, and under heavy load we may drop it to 50 or 30 RPM."
91+
msgstr "Sure, but please respect our rate limits. Normally it's 100 RPM, and under heavy load we may drop it to 50 or 30 RPM."
9292

9393
msgid "The API is meant for manual use or small projects. If your site uses our API to look up visitor IPs, please use a message queue so requests don't block. If your project has high traffic or needs low latency, you're better off using our open source offline database: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. That's actually what this project uses under the hood."
9494
msgstr "The API is meant for manual use or small projects. If your site uses our API to look up visitor IPs, please use a message queue so requests don't block. If your project has high traffic or needs low latency, you're better off using our open source offline database: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. That's actually what this project uses under the hood."

locales/es.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ msgstr "Envia una solicitud al endpoint <code>/json</code>, o envia una solicitu
8787
msgid "Can I call your service programmatically?"
8888
msgstr "Puedo llamar a su servicio de forma programatica?"
8989

90-
msgid "Sure, but please respect our rate limits. Normally it's 30 RPM, and under heavy load we may drop it to 10 or 5 RPM."
91-
msgstr "Claro, pero por favor respeta nuestros limites de velocidad. Normalmente es de 30 RPM, y bajo carga elevada podemos reducirlo a 10 o 5 RPM."
90+
msgid "Sure, but please respect our rate limits. Normally it's 100 RPM, and under heavy load we may drop it to 50 or 30 RPM."
91+
msgstr "Claro, pero por favor respeta nuestros limites de velocidad. Normalmente es de 100 RPM, y bajo carga elevada podemos reducirlo a 50 o 30 RPM."
9292

9393
msgid "The API is meant for manual use or small projects. If your site uses our API to look up visitor IPs, please use a message queue so requests don't block. If your project has high traffic or needs low latency, you're better off using our open source offline database: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. That's actually what this project uses under the hood."
9494
msgstr "La API esta pensada para uso manual o proyectos pequenos. Si tu sitio usa nuestra API para consultar las IP de los visitantes, utiliza una cola de mensajes para que las solicitudes no se bloqueen. Si tu proyecto tiene mucho trafico o necesita baja latencia, es mejor que uses nuestra base de datos offline de codigo abierto: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. De hecho, es lo que este proyecto usa internamente."

locales/fr.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ msgstr "Envoyez une requete au point de terminaison <code>/json</code>, ou envoy
8787
msgid "Can I call your service programmatically?"
8888
msgstr "Puis-je appeler votre service de maniere programmatique ?"
8989

90-
msgid "Sure, but please respect our rate limits. Normally it's 30 RPM, and under heavy load we may drop it to 10 or 5 RPM."
91-
msgstr "Bien sur, mais veuillez respecter nos limites de debit. Normalement c'est 30 RPM, et en cas de forte charge nous pouvons le reduire a 10 ou 5 RPM."
90+
msgid "Sure, but please respect our rate limits. Normally it's 100 RPM, and under heavy load we may drop it to 50 or 30 RPM."
91+
msgstr "Bien sur, mais veuillez respecter nos limites de debit. Normalement c'est 100 RPM, et en cas de forte charge nous pouvons le reduire a 50 ou 30 RPM."
9292

9393
msgid "The API is meant for manual use or small projects. If your site uses our API to look up visitor IPs, please use a message queue so requests don't block. If your project has high traffic or needs low latency, you're better off using our open source offline database: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. That's actually what this project uses under the hood."
9494
msgstr "L'API est concue pour un usage manuel ou de petits projets. Si votre site utilise notre API pour rechercher les IP des visiteurs, utilisez une file de messages pour que les requetes ne soient pas bloquees. Si votre projet a un trafic eleve ou necessite une faible latence, il vaut mieux utiliser notre base de donnees hors ligne open source : <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. C'est d'ailleurs ce que ce projet utilise en interne."

locales/id.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ msgstr "Kirim permintaan ke endpoint <code>/json</code>, atau kirim permintaan d
8787
msgid "Can I call your service programmatically?"
8888
msgstr "Bisakah saya memanggil layanan Anda secara programatik?"
8989

90-
msgid "Sure, but please respect our rate limits. Normally it's 30 RPM, and under heavy load we may drop it to 10 or 5 RPM."
91-
msgstr "Tentu, tapi mohon patuhi batas laju kami. Normalnya 30 RPM, dan saat beban tinggi kami mungkin menurunkannya ke 10 atau 5 RPM."
90+
msgid "Sure, but please respect our rate limits. Normally it's 100 RPM, and under heavy load we may drop it to 50 or 30 RPM."
91+
msgstr "Tentu, tapi mohon patuhi batas laju kami. Normalnya 100 RPM, dan saat beban tinggi kami mungkin menurunkannya ke 50 atau 30 RPM."
9292

9393
msgid "The API is meant for manual use or small projects. If your site uses our API to look up visitor IPs, please use a message queue so requests don't block. If your project has high traffic or needs low latency, you're better off using our open source offline database: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. That's actually what this project uses under the hood."
9494
msgstr "API ini ditujukan untuk penggunaan manual atau proyek kecil. Jika situs Anda menggunakan API kami untuk mencari IP pengunjung, gunakan antrean pesan agar permintaan tidak terblokir. Jika proyek Anda memiliki lalu lintas tinggi atau membutuhkan latensi rendah, lebih baik gunakan basis data offline sumber terbuka kami: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. Sebenarnya itulah yang digunakan proyek ini di balik layar."

locales/it.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ msgstr "Invia una richiesta all'endpoint <code>/json</code>, oppure invia una ri
8787
msgid "Can I call your service programmatically?"
8888
msgstr "Posso chiamare il vostro servizio in modo programmatico?"
8989

90-
msgid "Sure, but please respect our rate limits. Normally it's 30 RPM, and under heavy load we may drop it to 10 or 5 RPM."
91-
msgstr "Certo, ma rispetta i nostri limiti di frequenza. Normalmente e 30 RPM, e sotto carico elevato potremmo ridurlo a 10 o 5 RPM."
90+
msgid "Sure, but please respect our rate limits. Normally it's 100 RPM, and under heavy load we may drop it to 50 or 30 RPM."
91+
msgstr "Certo, ma rispetta i nostri limiti di frequenza. Normalmente e 100 RPM, e sotto carico elevato potremmo ridurlo a 50 o 30 RPM."
9292

9393
msgid "The API is meant for manual use or small projects. If your site uses our API to look up visitor IPs, please use a message queue so requests don't block. If your project has high traffic or needs low latency, you're better off using our open source offline database: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. That's actually what this project uses under the hood."
9494
msgstr "L'API e pensata per l'uso manuale o piccoli progetti. Se il tuo sito usa la nostra API per cercare gli IP dei visitatori, usa una coda di messaggi per evitare che le richieste si blocchino. Se il tuo progetto ha un traffico elevato o necessita di bassa latenza, e meglio usare il nostro database offline open source: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. In realta e proprio quello che questo progetto usa internamente."

locales/ja.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ msgstr "<code>/json</code> エンドポイントにリクエストを送信す
8787
msgid "Can I call your service programmatically?"
8888
msgstr "プログラムからこのサービスを呼び出せますか?"
8989

90-
msgid "Sure, but please respect our rate limits. Normally it's 30 RPM, and under heavy load we may drop it to 10 or 5 RPM."
91-
msgstr "もちろんですが、レート制限を守ってください。通常は30 RPMで、高負荷時には10または5 RPMに制限する場合があります。"
90+
msgid "Sure, but please respect our rate limits. Normally it's 100 RPM, and under heavy load we may drop it to 50 or 30 RPM."
91+
msgstr "もちろんですが、レート制限を守ってください。通常は100 RPMで、高負荷時には50または30 RPMに制限する場合があります。"
9292

9393
msgid "The API is meant for manual use or small projects. If your site uses our API to look up visitor IPs, please use a message queue so requests don't block. If your project has high traffic or needs low latency, you're better off using our open source offline database: <a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>. That's actually what this project uses under the hood."
9494
msgstr "このAPIは手動での利用や小規模プロジェクト向けです。サイトで当APIを使って訪問者のIPを調べる場合は、リクエストがブロックされないようメッセージキューを使ってください。高トラフィックや低レイテンシが必要なプロジェクトの場合は、オープンソースのオフラインデータベースを使う方がよいでしょう:<a href=\"https://github.com/NetworkCats/Merged-IP-Data\">Merged IP Database</a>。実はこのプロジェクトも内部で同じものを使っています。"

0 commit comments

Comments
 (0)