On Sunday, December 20, 2015 at 9:32:39 PM UTC-5, Srikanth Bemineni wrote: > > > Hi , > > I am working on getting the requirements for starting a new project ,using > pyramid framework. My project needs to work with both a SQL database(Mostly > probably MYSql) and Cassandra. I am currently at a stage where I am > deciding on the Cassandra connection issues. One of the issue that came > across is the same connection used in multiple fork issue, where multiple > forks of uWSGI using the same cassandra connection from the main scope and > timing out. The solution is to use @post_fork() decorator, > > So, My question is , what is the best practice ? is it good to enable > lazy-apps, which is by default or disable lazy-apps. Will this also affect > SQAlchemy DB sessions ?. What are the cons and pros of the enabling and > disabling lazy-apps from pyramid perspective. Will forking effect any > other services, that we use for a basic website, like payment system, email > services etc... > > Srikanth Bemineni > > > I use lazy-apps in production which acts the same as an application loaded by itself. The only issue I've run into is getting uWSGI to quit if one of the lazy-app instances fails to load. There was some configuration necessary to make uWSGI exit when that happens so that supervisor could detect and report it. This may not be necessary in your case anyway. The only reason we use lazy-apps is because we didn't want to add the post_fork logic our applications at the time we setup uWSGI.
It's unlikely that forking would cause any issues except with SQLAlchemy's session pool which requires the post_fork solution. I think it is libpq that restricts it from sharing the connections with forked processes. No issues should come up with any python libraries unless they specifically say they do not support forking. My understanding is the only difference is the amount of memory usage. When forked some of the python process memory is shared reducing the total usage. There are some graceful reloading setups that need to take into consideration lazy-apps vs forking which you can read about at http://uwsgi-docs.readthedocs.org/en/latest/articles/TheArtOfGracefulReloading.html#preforking-vs-lazy-apps-vs-lazy -- Jason -- 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]. Visit this group at https://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
