From: Chris W. <ch...@cw...> - 2005-06-28 15:30:41
|
On Jun 19, 2005, at 11:01 AM, Antti M V=E4h=E4kotam=E4ki wrote: > After a good night sleep I came to the conclusion that maybe =20 > providing a way not to preload everything is not very urgent and it =20= > might be good to delay it for a 2.x release. This has been my general thought as well. However... your points =20 about loading/creating actions at startup might be solved fairly =20 elegantly with a lazy loading scheme. For instance, in OI2 action we =20 have a name -> prototype mapping. Whenever we get a request for a new=20 () action we grab the prototype, clone it, and assign all the =20 inbound parameters to it. (So new() actually acts like a factory, but =20= it's hidden.) There's nothing stopping us from replacing the prototype in that map =20 with a lazy loading routine. On the first access it will go through =20 the same functions currently in OI2::Setup::InitializeActions (which =20 is fairly minimal). Doing this for SPOPS is much trickier (and probably undoable) because =20= of the dependencies -- if an object contains other objects we need to =20= make sure the contained is loaded, and if the contained contains =20 other objects we need to ensure THAT is loaded.... yuck. > ... > I'm not really sure if OI2 will ever be really usable with CGI =20 > though. Even if the required initialization could be dropped =20 > somewhere close to 25 Mb, after leaving the 7 mb of mod_perl =20 > apache, it still leaves 18 Mb of modules to be initialized on each =20 > request. But it would still be nice to have a bit smaller apache =20 > threads when having multiple OI2 installations on the same machine =20 > and use CGI when developing, so that one would not have to restart =20 > apache after each change. I agree -- CGI compatibility is interesting for development (you =20 don't need to restart Apache with every change) and for small-traffic =20= internal/individual sites can be usable. But not much more than that. Regarding restarting Apache, this is very difficult due to SPOPS and =20 the fact that it generates code at runtime. There's been a =20 longstanding request to store the generated code into modules on the =20 filesystem and I think that would solve the difficult reload issue. ...then again, we do runtime initialization of other parts of the =20 system as well. For instance, the above action-creation stuff =20 wouldn't do the right thing if you modified the action class with =20 Apache::Reload because we'd still have the prototype stored... ...then again, since this is a development vs. production issue, =20 maybe we can make flaggable the ability to initialize actions at =20 startup, or ever. So every time you get a new() action it does all =20 the initialization stuff every time. Mulling over it a bit more I =20 think this is a good option. Time to create a JIRA task... Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |