I think the ability to create the interp up front (on startup) is really 
useful. Yes, “lazy” creation of the interp on first request could be a thing 
too, but I think maybe we need a preference here. In my case, I’m currently 
doing “lazy” loading, not of the interpreters, but of my code. So, the first 
time a request comes in, it sees I haven’t “init’d” this interp, and does the 
initialization.

The problem with this approach is that the “init” can take a couple seconds 
with all the bits I’m loading in, which means the first person to hit a new 
interp is getting a really crappy experience. I would prefer to do all the init 
on startup of the child and interp so that the child isn’t really even ready to 
serve requests unless it has already gone through my init.

I’m not ENTIRELY sure what I’ve just said is relevant to this conversation. If 
not, pleas excuse me and just consider them the ramblings of an old man. :)

D


> On Sep 11, 2015, at 1:22 PM, Anton Osennikov <a...@perm.ru> wrote:
> 
> 11.09.2015 14:18, Massimo Manghi пишет:
> 
>> Interpreters will be created and initialized only when the first request
>> for a specific virtual host comes in
> 
> I doubt that to initialize an intrepreter when request comes is a good 
> solution.
> 
> I'm running a custom rivet child init script now which creates child 
> interpreter for a virtual host on the first request for this virtual host, 
> and loads Tcl code into this interpreter via "source".
> 
> It worked good enough for years.
> 
> After upgrade from Tcl8.5 + Itcl3 to Tcl8.6 + Itcl4 some Tcl source files are 
> loaded many times (>50) slower now. These are modules that create hundreds 
> (about 500) of Itcl objects. These objects describe implemented report items: 
> tables, columns, charts, etc.
> 
> As a possible workaround I'm looking for a way to pre-load my sources before 
> actual request comes now..
> 
> "source" times demo:
> 
> $ tclsh8.5
> % package require nemoweb
> 1178 us source -encoding utf-8 
> /opt/ActiveTcl-8.5/lib/teapot/package/tcl/teapot/tcl8/8.2/cmdline-1.5.tm 
> [27252]
> ...
> 39897 us source /usr/local/lib/nemo/nemoweb.tcl [27252]
> 2.6b3
> %
> 
> $  tclsh8.6
> % package require nemoweb
> 1150 us source -encoding utf-8 
> /opt/ActiveTcl-8.6/lib/teapot/package/tcl/teapot/tcl8/8.2/cmdline-1.5.tm 
> [27512]
> /..
> 2947621 us source /usr/local/lib/nemo/nemoweb.tcl [27512]
> 2.6b3
> %
> 
> -- 
> Best regards, Anton.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
> For additional commands, e-mail: rivet-dev-h...@tcl.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org
For additional commands, e-mail: rivet-dev-h...@tcl.apache.org

Reply via email to