On Tuesday, November 15, 2016 at 2:48:02 PM UTC-5, Mikko Ohtamaa wrote:
 

> The problem I was facing (there might be others) that you cannot fork 
> process after SQLAlchemy pool is set up.
>

You can fork after the SqlAlchemy pool is set up -- you just have to call 
`.dispose()` on the sqlalchemy engine.  This is supported and documented 
 [http://docs.sqlalchemy.org/en/latest/core/connections.html#engine-disposal]

In our deployment, we communicate with PostgreSQL and MongoDB to pull out 
certain data before the fork.  If we did not do that, we'd have a 
bottleneck of 12+ processes from each node hitting the db server at once, 
and would not be able to take advantage of copy-on-write functionality of 
the deployment containers.  

There are also other libraries that require a hook at fork to work 
properly, such as PyCrypto's random number generator.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/b92dbc91-7720-4332-a548-023b2c477732%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to