Search code examples
pythonflaskgunicorngevent

How to setup gevent monitor thread with gunicorn


I am using gevent workers with gunicorn for my flask application. I am facing issues where my greenlets are getting blocked for long periods. gevent provides monitoring via monitor threads. Is it possible to setup this monitor thread when using gevent workers with gunicorn. If yes , can someone share a possible example. I have looked up multiple example but none of them are working. versions being used in my application

python==3.8
gevent==21.1.2
gunicorn==20.1.0

Solution

  • To enable this we have to set the environment variable GEVENT_MONITOR_THREAD_ENABLE and that enables the monitor. For more configuration we can refer the doc here