Bruno: Sorry but I don't agree. We cannot solve the python threading problems (mostly caused by the GIL assumptions I think). It is simply out of the scope of the web2py project.
So if you have a really big app and import everything, it will surely have an important memory footprint. It goes worse when you need several processes to archive greater concurrency, so you end having big startup times to load and import your app per each process, and a huge memory consumption. Consider a webhosting company, it could be a serious issue with multiple big apps like this. Threading.local only add more troubles to this mess, so you can't have async concurrency (async io loops is were I think we should go). Of course, this only happens to realy realy realy big apps, so most python and web2py users should not be concerned. I think that in that cases there are better solutions, like GAE. Namespaces are great and we use them, and we have a local/"global" context for each request that no other framework has, so we have an advantage here, not a disvantage IMHO BTW, I attended to the Graham Dumpleton talk about web server performance, where he explained that in the most cases, python is not the main problem you face, there are many other factors than can be optimized too. Best regards, Mariano Reingart http://www.sistemasagiles.com.ar http://reingart.blogspot.com On Tue, Mar 13, 2012 at 12:20 PM, Bruno Rocha <[email protected]> wrote: > Mariano, if you are saying that importing anything and using "current" > object inside the modules that we are importing is a problem, so I guess we > really have a big problem! > > Many small apps can rely on some basic model execution system, but even if > cached it would be still "strange" to have all of them loaded in cache. One > of the most brilhant features of Python and any other modern language is the > "namespaces" feature. So I can't imagine a big app without relying on > namespaces, modules, packages, classes etc.. Thats the best way for > programming in Python, and IMO: also thats the best way for programming in > web2py. > > If threading.locals() has a problem,I think the goal should be to solve that > problem, not to cache the models or to create routing hacks. (* I think map > models is a good idea, but it is not a solution) > > Do you have any further information about that issue? > > > > > On Tue, Mar 13, 2012 at 4:06 PM, Mariano Reingart <[email protected]> > wrote: >> >> WARNING with import and threading.local(): they were hot topics on the >> pycon webdev summit, and other frameworks are facing problems with >> them. >> >> They could be memory hungry and contention problems could arise, so >> they could have scalabillity issues too. >> >> I think the web2py way is not so bad, but we should find some way to >> cache the models. >> >> Best regards, >> >> Mariano Reingart >> http://www.sistemasagiles.com.ar >> http://reingart.blogspot.com > > > > > -- > > Bruno Rocha > [http://rochacbruno.com.br] >

