Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
Sequential request processing (CPU-heavy processing)

I am running a compute-heavy Flask app behind gunicorn. Requests are handled by Nginx that passes them onto gunicorn and the Flask app:

gunicorn -access-logfile - wsgi --bind 127.0.0.1:5002 --workers 2 --threads 8

Each request takes about 1 second to process (CPU-heavy). If two requests arrive in close succession, I would like the second request to "wait", while the first is being processed. But instead it seems that both requests get slower as the CPU attempts to process both in parallel.

Is there a way to force the app to process incoming requests sequentially?

Thank you!

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use python-filelock to achieve your goal, try to acquire the same lock on all processes/threads before running your CPU-heavy code.

But I am not sure why do you use --workers 2 --threads 8. This answer to the question "How many concurrent requests does a single Flask process receive?" , might also provide an answer to your usecase

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda