From: sophana <so...@zi...> - 2007-01-18 16:41:54
|
Hi I wrote my first (big) web application with webware, and am really happy with it. There is still something that I would like to get confirmed: I have a big object that takes some time to be instantiated. This is why I would like to instantiate it once per webware execution thread. Do you think that the page __init__ method is the place to store this object instance? When are Page object created? Is it at the first request of a thread? Do they remain in memory until the thread is closed? If the object is not thread safe, can I still use it safely inside the Page instance? Thanks for this great simple and powerful framework! Keep up the good work! |
From: Christoph Z. <ci...@on...> - 2007-01-20 09:22:33
|
sophana wrote: > There is still something that I would like to get confirmed: > I have a big object that takes some time to be instantiated. This is why > I would like to instantiate it once per webware execution thread. > Do you think that the page __init__ method is the place to store this > object instance? > When are Page object created? Is it at the first request of a thread? Do > they remain in memory until the thread is closed? You can configure this with the Application.config settings CacheServletClasses and CacheServletInstances. If you set them to yes, then it is like you write. You may also consider instantiating your object in the function __init__.contextInitialize(app, ctxPath). This is only executed once when the context is initialized. -- Christoph |
From: sophana <so...@zi...> - 2007-01-23 07:43:38
|
Christoph Zwerschke a =E9crit : > sophana wrote: > =20 >> There is still something that I would like to get confirmed: >> I have a big object that takes some time to be instantiated. This is w= hy >> I would like to instantiate it once per webware execution thread. >> Do you think that the page __init__ method is the place to store this >> object instance? >> When are Page object created? Is it at the first request of a thread? = Do >> they remain in memory until the thread is closed? >> =20 > > You can configure this with the Application.config settings=20 > CacheServletClasses and CacheServletInstances. If you set them to yes,=20 > then it is like you write. > =20 Ok thanks! I was wondering why I couldn't find any documentation about this. I finally found it in the 0.7 webkit doc, but it is not is the 0.9 doc http://webware.sourceforge.net/Webware-0.7/WebKit/Docs/UsersGuide.html http://webware.sourceforge.net/Webware-0.9.2/WebKit/Docs/UsersGuide.html Where is it gone? > You may also consider instantiating your object in the function=20 > __init__.contextInitialize(app, ctxPath). This is only executed once=20 > when the context is initialized. > > =20 Yes but I think it is launched once per process, and not once per thread. Am I right? |
From: Christoph Z. <ci...@on...> - 2007-01-23 08:43:23
|
sophana schrieb : > Christoph Zwerschke a =E9crit : >> You can configure this with the Application.config settings=20 >> CacheServletClasses and CacheServletInstances. If you set them to yes,= =20 >> then it is like you write. >> =20 > Ok thanks! > I was wondering why I couldn't find any documentation about this. > I finally found it in the 0.7 webkit doc, but it is not is the 0.9 doc > http://webware.sourceforge.net/Webware-0.7/WebKit/Docs/UsersGuide.html > http://webware.sourceforge.net/Webware-0.9.2/WebKit/Docs/UsersGuide.htm= l >=20 > Where is it gone? It has been sourced out to a separate Configuration Guide. You'll find a link to it in the chapter "Configuration". >> You may also consider instantiating your object in the function=20 >> __init__.contextInitialize(app, ctxPath). This is only executed once=20 >> when the context is initialized. >> > Yes but I think it is launched once per process, and not once per threa= d. > Am I right? Right. The context is only initialized once by the Application server. -- Christoph |