As Anthony suggests you can move code to modules and import modules. Module can have global level variables (that do not depend on the user or the request) that will be persistant within the process that imports the module.
Database connections anyway, are handled by web2py in an efficient way already, by using connection pooling. On Oct 30, 10:30 am, Anthony <abasta...@gmail.com> wrote: > On Sunday, October 30, 2011 11:21:56 AM UTC-4, Ray (a.k.a. Iceberg) wrote: > > > I guess what he concerns is performance. In other word, "web2py re- > > instantiate all class, variables, app logics, etc. ... every time a > > page is loaded. > > Only the stuff in models, and you can reduce that by using conditional > models or by moving some code to modules and calling only when needed. > > Anthony