Gunicorn: how to share object in work process, and timing to change object.

Created on 29 Jan 2018  ·  4Comments  ·  Source: benoitc/gunicorn

Question

All 4 comments

can gunicorn deal with ? emgency!

It's not very clear what you're asking.

gunicorn doesn't contain any support for sharing objects between different worker processes. You'll need to use your own approach for that. There are many options depending on your needs. These include:

  • a NoSQL data store like Redis or ZODB
  • a SQL database like MySQL or sqlite
  • a dedicated process handling all the data that you communicate with, such as a Celery queue or even your own use of sockets.

1.can i share the file in the different work process?
before start gunicorn, i read the file in memory, and time to change the memory。

In some case, for example : machine learning . Always have a big data model, and this model is read only. In order to use multi-core on a computer, we should use multi-processor instead muti-thread, so gunicorn can share common data between all processors will be very useful.

Was this page helpful?
0 / 5 - 0 ratings