[Python] Python threading: Python gevent using long running C extensions

Discussão em 'Python' iniciado por Stack, Agosto 12, 2025.

  1. Stack

    Stack Membro Participativo

    I have a flask app that uses a large integer optimization GoogleOrTools. The underlying package is written in C but there is a python API that I use to call it. When I get a very long running task it seems as if it blocks other tasks and server becomes unresponsive. The obvious solution is naturally to put in a different service. Which I will implement when I have the time.

    But I'm curious if there is something I'm missing as I read Python threading after every x lines of byte code the thread changes, which should allow the other process to take over? But does that also happen in the case of Gevent? Or if it is actually allowing the other threads, but it might greedily capture all the resources?

    It would be really nice if someone with some inside could tell me what is and is not possible.

    Continue reading...

Compartilhe esta Página