From b67b4b433575ef99f2c5fe76e3f9f97f6992f140 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Wed, 8 Dec 2021 18:04:32 +0100 Subject: [PATCH] Download rate limit to 3rps. --- docker/nginx/conf.d/server/server.api | 16 ++++++++-------- docker/nginx/nginx.conf | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docker/nginx/conf.d/server/server.api b/docker/nginx/conf.d/server/server.api index 09a62356..4e6a4b7b 100644 --- a/docker/nginx/conf.d/server/server.api +++ b/docker/nginx/conf.d/server/server.api @@ -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; diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf index c5de597f..6310f2c8 100644 --- a/docker/nginx/nginx.conf +++ b/docker/nginx/nginx.conf @@ -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;