You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-user@tcl.apache.org by "Ashok P. Nadkarni" <ap...@yahoo.com> on 2008/12/20 04:21:53 UTC
Changing maxrequests on an interpreter in websh.conf when it is specific
to each file
I'm playing around with using namespaces and slaves to reduce the time
to deliver a web page by making the interpreter handle multiple
requests. The websh.conf file has the lines
# individual scripts (each with its own interpreters)
if {[string match *.ws3 $file]} {
return $file
}
in the web::interpmap command. The question is, not how do I write the
corresponding web::interpclasscfg command to change maxrequests to (say)
10 ? interpmap takes the class name as a parameter but since that
changes on a per file basis, how do I change it? The ws3 files may lie
in different directories so I don't want to hardcode or enumerate full
paths if possible.
A somewhat related question is that I want the html handler to be
specific to the directory that the html file lives in. So I've modified
the html handler fragment in web::interpmap in websh.conf to be
# default html content (html that contains snipplets only)
# all requests for *.html files share interpreters
if {[string match *.html $file]} {
return [file join [file dirname $file] htmlhandler.ws3]
}
Again, I have the same question, how do I now configure interpclasscfg
for each to change the maxrequests without having to list out each
possible directory as a separate class ? (maxrequests will be same for all)
Any solutions ?
Thanks
/Ashok
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org
Re: Changing maxrequests on an interpreter in websh.conf when it is specific to each file
Posted by Ronnie Brunner <ro...@netcetera.ch>.
> To answer my own question, I landed up doing the following:
>
> if {[string match *.html $file]} {
> set script [file join [file dirname $file] htmlhandler.ws3]
> web::interpclasscfg $script maxrequests 10
> return $script
> }
>
> Not sure what impact that might have on memory (separate interpclass
> structures per file?) but it does what I want for the time being in
> terms of quicker startup.
There's no impact on memory as you have an interpclass for every
script you use anyway. The only impact is that you call
web::interpclasscfg way too often. It is not really an expensive call
though, but it needs an additional lock on some internal resource and
locks can be bottlenecks. I can't tell you however whether this is
worse than creating the overhead of tracking the files you already
have configured:
if {[string match *.html $file]} {
set script [file join [file dirname $file] htmlhandler.ws3]
if {![info exists pool($script)]} {
web::interpclasscfg $script maxrequests 10
set pool($script) 1
}
return $script
}
This takes a bit more memory (the pool array) but as I said: don't
know if it actually makes a difference. Could be even slower...
Ronnie
--
Ronnie Brunner | ronnie.brunner@netcetera.ch
phone +41-44-247 79 79 | fax +41-44-247 70 75
Netcetera AG | 8040 Zürich | Switzerland | http://netcetera.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org
Re: Changing maxrequests on an interpreter in websh.conf when it
is specific to each file
Posted by "Ashok P. Nadkarni" <ap...@yahoo.com>.
To answer my own question, I landed up doing the following:
if {[string match *.html $file]} {
set script [file join [file dirname $file] htmlhandler.ws3]
web::interpclasscfg $script maxrequests 10
return $script
}
Not sure what impact that might have on memory (separate interpclass
structures per file?) but it does what I want for the time being in
terms of quicker startup.
/Ashok
Ashok P. Nadkarni wrote:
> I'm playing around with using namespaces and slaves to reduce the time
> to deliver a web page by making the interpreter handle multiple
> requests. The websh.conf file has the lines
>
> # individual scripts (each with its own interpreters)
> if {[string match *.ws3 $file]} {
> return $file
> }
>
> in the web::interpmap command. The question is, not how do I write the
> corresponding web::interpclasscfg command to change maxrequests to
> (say) 10 ? interpmap takes the class name as a parameter but since
> that changes on a per file basis, how do I change it? The ws3 files
> may lie in different directories so I don't want to hardcode or
> enumerate full paths if possible.
>
> A somewhat related question is that I want the html handler to be
> specific to the directory that the html file lives in. So I've
> modified the html handler fragment in web::interpmap in websh.conf to be
>
> # default html content (html that contains snipplets only)
> # all requests for *.html files share interpreters
> if {[string match *.html $file]} {
> return [file join [file dirname $file] htmlhandler.ws3]
> }
>
> Again, I have the same question, how do I now configure interpclasscfg
> for each to change the maxrequests without having to list out each
> possible directory as a separate class ? (maxrequests will be same for
> all)
>
> Any solutions ?
>
> Thanks
>
> /Ashok
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
> For additional commands, e-mail: websh-user-help@tcl.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org