Download rate limit to 3rps.

This commit is contained in:
Ivaylo Novakov 2021-12-08 18:04:32 +01:00
parent 25af756a14
commit b67b4b4335
No known key found for this signature in database
GPG Key ID: 06B9354AB08BE9C6
2 changed files with 10 additions and 10 deletions

View File

@ -177,13 +177,13 @@ location /skynet/skyfile {
limit_req zone=uploads_by_ip burst=10 nodelay;
limit_req zone=uploads_by_ip_throttled;
limit_req zone=downloads_by_ip burst=5 nodelay;
limit_req zone=downloads_by_ip burst=3 nodelay;
limit_req zone=downloads_by_ip_throttled;
limit_conn upload_conn 5;
limit_conn upload_conn_rl 1;
limit_conn download_conn 5;
limit_conn download_conn 3;
limit_conn download_conn_rl 1;
client_max_body_size 1000M; # make sure to limit the size of upload to a sane value
@ -221,13 +221,13 @@ location /skynet/tus {
limit_req zone=uploads_by_ip burst=10 nodelay;
limit_req zone=uploads_by_ip_throttled;
limit_req zone=downloads_by_ip burst=5 nodelay;
limit_req zone=downloads_by_ip burst=3 nodelay;
limit_req zone=downloads_by_ip_throttled;
limit_conn upload_conn 5;
limit_conn upload_conn 3;
limit_conn upload_conn_rl 1;
limit_conn download_conn 5;
limit_conn download_conn 3;
limit_conn download_conn_rl 1;
# TUS chunks size is 40M + leaving 10M of breathing room
@ -298,13 +298,13 @@ location /skynet/pin {
limit_req zone=uploads_by_ip burst=10 nodelay;
limit_req zone=uploads_by_ip_throttled;
limit_req zone=downloads_by_ip burst=5 nodelay;
limit_req zone=downloads_by_ip burst=3 nodelay;
limit_req zone=downloads_by_ip_throttled;
limit_conn upload_conn 5;
limit_conn upload_conn 3;
limit_conn upload_conn_rl 1;
limit_conn download_conn 5;
limit_conn download_conn 3;
limit_conn download_conn_rl 1;
proxy_set_header User-Agent: Sia-Agent;

View File

@ -99,8 +99,8 @@ http {
limit_req_zone $binary_remote_addr zone=uploads_by_ip:10m rate=10r/s;
limit_req_zone $limit_key zone=uploads_by_ip_throttled:10m rate=10r/m;
limit_req_zone $binary_remote_addr zone=downloads_by_ip:10m rate=5r/s;
limit_req_zone $limit_key zone=downloads_by_ip_throttled:10m rate=5r/m;
limit_req_zone $binary_remote_addr zone=downloads_by_ip:10m rate=3r/s;
limit_req_zone $limit_key zone=downloads_by_ip_throttled:10m rate=3r/m;
limit_req_zone $binary_remote_addr zone=registry_access_by_ip:10m rate=60r/m;
limit_req_zone $limit_key zone=registry_access_by_ip_throttled:10m rate=20r/m;