Global variables when using gunicorn

2,748 views
Skip to first unread message

Mathieu Drapeau

unread,
Sep 6, 2014, 6:18:04 PM9/6/14
to pylons-...@googlegroups.com
What's the easiest way to use app-wide global variables when running over gunicorn with multiple workers?

Mathieu Drapeau

unread,
Sep 6, 2014, 6:21:47 PM9/6/14
to pylons-...@googlegroups.com
(worker class is gevent)

Mathieu Drapeau

unread,
Sep 9, 2014, 12:45:13 PM9/9/14
to pylons-...@googlegroups.com
Looking at the gunicorn code it seems that each workers is forked unfortunately even if you specify gevent as worker class.
So nothing could be done in a simple manner, need to use a pile of external solutions (redis queue, zmq interprocess communication, Listener, etc) even for a simple shared counter!

On Saturday, September 6, 2014 6:21:47 PM UTC-4, Mathieu Drapeau wrote:
(worker class is gevent)

Jonathan Vanasco

unread,
Sep 9, 2014, 2:04:14 PM9/9/14
to pylons-...@googlegroups.com
Try searching "shared memory gunicorn"

While gunicorn doesn't support shared memory, there are a lot of "workarounds" on various lists and stack overflow to solve your exact need.  Most of them seem indexed under the "shared memory" concept.
Reply all
Reply to author
Forward
0 new messages