Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions roles/services/frontend/templates/nginx-frontend.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ proxy_cache_path {{ frontend_cache_path }}/thumbnail levels=1:2 keys_zone=thumbn
# Allow hole-punching in proxy with `?nocache=true`.
proxy_cache_bypass $cookie_nocache $arg_nocache;

# TODO: Whitelist for load testing.
# https://gadelkareem.com/2012/03/25/limit-requests-per-ip-on-nginx-using-httplimitzonemodule-and-httplimitreqmodule-except-whitelist/
limit_req_zone $binary_remote_addr zone=search_reqs:10m rate=200r/s;
limit_conn_zone $binary_remote_addr zone=search_conns:10m;

Expand All @@ -37,7 +39,7 @@ server {
}

upstream search {
ip_hash;
# ip_hash;
keepalive {{ groups['search_api'] | length * 2 }}; # 2 connections per backend server.

{% for host in groups['search_api'] %}
Expand Down Expand Up @@ -83,8 +85,8 @@ server {

server_name {{ api_server_name }};

limit_req zone=search_reqs burst=300;
limit_conn search_conns 200; # Concurrent requests per client IP.
# limit_req zone=search_reqs burst=300;
# limit_conn search_conns 200; # Concurrent requests per client IP.

location / {
return 301 https://app.swaggerhub.com/apis-docs/ipfs-search/ipfs-search;
Expand Down