Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
Nginx reverse proxy is not responding to requests after load test

I have deployed Gunicorn (with flask) behind Nginx (as a proxy server). I use 2 docker containers (Gunicorn , Nginx).

I started a load test of "5000 concurrent users", sending requests to the Nginx server on port 80 (using Locust). after few seconds i stopped the load test. After I stopped the load test, Nginx stopped to respond to requests at all (but I can still send requests to Gunicorn directly on port 8000).

Im not expecting Nginx to respond to so many concurrent requests while running on my system with 1 Gunicorn server, but why it's not responding to requests anymore? I need to restart the Nginx container to make it available again. The reason I added Nginx is because I observed the same behavior while performing load tests on Gunicorn directly.

I would expected Nginx to either block or queue requests , but not to freeze/block requests forever.

What am i doing wrong? What is the correct configuration to allow many concurrent requests (using 1 Nginx container & 1 Gunicorn container)?

My system: MacBook Pro 2.9 GHz 6-Core Intel Core i9 32 GB 2400 MHz DDR4

Gunicorn config:

bind = '0.0.0.0:8000',
workers = 8 (sync),
loglevel = 'info',
preload_app=true

Nginx config:

worker_processes 8;

user nobody nogroup;
error_log /dev/stdout info;
pid /var/run/nginx.pid;
    
events {
  worker_connections 20000; # increase if you have lots of clients
  accept_mutex on; # set to 'on' if nginx worker_processes > 1
    }
    
http {
  include mime.types;
  default_type application/octet-stream;
  access_log /var/log/nginx/access.log combined;
  sendfile on;


  server {
    # if no Host match, close the connection to prevent host spoofing
    listen 80 default_server;
    return 444;
  }

  server {
    listen 80;
    client_max_body_size 4G;

    # set the correct host(s) for your site
    server_name localhost;

    keepalive_timeout 5;

    # path for static files
    root /path/to/app/current/public;

    location / {
      # checks for static file, if not found proxy to app
      try_files $uri @proxy_to_app;
    }

    location @proxy_to_app {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header Host $http_host;
      # we don't want nginx trying to do something clever with
      # redirects, we set the Host: header above already.
      proxy_redirect off;
      proxy_pass http://flask-container:8000;
    }

    error_page 500 502 503 504 /500.html;
    location = /500.html {
    root /path/to/app/current/public;
    }
      }
    }

Thanks is advance.

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda