Global variables when using gunicorn

2 731 vues
Accéder directement au premier message non lu

Mathieu Drapeau

non lue,
6 sept. 2014, 18:18:0406/09/2014
à pylons-...@googlegroups.com
What's the easiest way to use app-wide global variables when running over gunicorn with multiple workers?

Mathieu Drapeau

non lue,
6 sept. 2014, 18:21:4706/09/2014
à pylons-...@googlegroups.com
(worker class is gevent)

Mathieu Drapeau

non lue,
9 sept. 2014, 12:45:1309/09/2014
à 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

non lue,
9 sept. 2014, 14:04:1409/09/2014
à 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.
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message