Hi Massimo,

In the first post of this thread, Arturo said,

"Is there a way in web2py to have varibles be persistent. For example
when I instantiate a class I don't want to re-instantiate it every
time a page is loaded."

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. Isn't that sounds slow?" Do we have a doc for this
faq? By the way, does binary compiling a web2py app help much in this
aspect?

Regards,
Ray


On Oct 30, 10:40 pm, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> this is not a web2py issue. This is an issue for all web applications.
>
> What if your application is replicated on two server behing a load
> balancer? The two servers cannot share objects. What if you use a web
> servers that forks (apache can) than different requests are executed
> by different processes, not different threads? Processes cannot share
> objects. What if you have to restart the web server for maintenance
> purposes? Do you want to store all persistent data?
> The same user may request two pages and these two pages may be server
> by different servers or different processes.
>
> Web applications must be written without persistent objects. State is
> share using the database, using sessions and using cache.
>
> The bahvior you seek can be mimicked by serializing/deserializing the
> objects at every request in session or cache.
>
> Massimo
>
> On Oct 30, 4:39 am, evilaliv3 <evilal...@gmail.com> wrote:
>
>
>
>
>
>
>
> > On 30 Ott, 00:39, Massimo Di Pierro <massimo.dipie...@gmail.com>
> > wrote:
>
> > > You must use cache.ram but this is not guaranteed to work.
>
> > Excuse me Massimo,
> > but, if i understand well this answer, there is no way to have also a
> > persistent connection to the database or a global application variable
> > in web2py?
> > for every request the whole application is reinitialized?
>
> > > In a multi-threaded environment the web server decides which threads
> > > to start/stop/kill.
>
> > does this happen in a deterministic fashion? is there some
> > documentation about?
>
> > Giovanni Pellerano

Reply via email to