List Info

Thread: Interpreter scope




Interpreter scope
user name
2007-02-28 04:04:14
Hi,

the default interpreter scope is request. That means a
certain interpreter is 
locked during the whole request cycle. I use modperl mostly
in the 
pre-response phases plus sometimes as an output filter. But
I use pnotes to 
pass data between the phases. If I understand it correctly
this forbids a 
handler interpreter scope. Now I'd like to release the
interpreter in most 
cases just before the response phase. So it can be reused by
another request 
while the current request sends its data over a possibly
slow network.

Is that reasonable?

Is there something like
$r->release_interp_after_this_phase()?

If not what is the right place to start looking/patching?
And what pitfalls 
are there to watch out?

Torsten
Re: Interpreter scope
country flaguser name
United States
2007-02-28 09:10:39
On Wed, 28 Feb 2007 11:04:14 +0100
Torsten Foertsch <torsten.foertschgmx.net> wrote:

> Hi,
> 
> the default interpreter scope is request. That means a
certain
> interpreter is locked during the whole request cycle. I
use modperl
> mostly in the pre-response phases plus sometimes as an
output filter.
> But I use pnotes to pass data between the phases. If I
understand it
> correctly this forbids a handler interpreter scope. Now
I'd like to
> release the interpreter in most cases just before the
response phase.
> So it can be reused by another request while the
current request
> sends its data over a possibly slow network.
> 
> Is that reasonable?
> 
> Is there something like
$r->release_interp_after_this_phase()?
> 
> If not what is the right place to start
looking/patching? And what
> pitfalls are there to watch out?

   Have you looked into using a lightweight front end setup
to handle
   this?  I've had great success with the more traditional
light/heavy
   Apache setup with mod_proxy, perlbal is awesome, and know

   many people who use things like lighttpd or pound. 

 ---------------------------------
   Frank Wiles <frankwiles.org>
   http://www.wiles.org
 ---------------------------------


------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeperl.apache.org
For additional commands, e-mail: dev-helpperl.apache.org


Re: Interpreter scope
country flaguser name
United States
2007-02-28 09:29:13
Torsten Foertsch wrote:
> I use pnotes to 
> pass data between the phases. If I understand it
correctly this forbids a 
> handler interpreter scope.

You might try using notes() instead, since I don't think it
cares about 
which interpreter is used.  You can use Storable to stuff
things into it 
if your data is more than just a string.

- Perrin

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeperl.apache.org
For additional commands, e-mail: dev-helpperl.apache.org


Re: Interpreter scope
user name
2007-05-01 12:16:36
On Monday 23 April 2007 07:08, Philippe M. Chiasson wrote: > > Is there something like $r->release_interp_after_this_phase()? > > Nope, but writing one would be very simple, all that's needed is > to call > >   MpInterpPUTBACK_On(interp) > apr_pool_cleanup_kill(r->pool, r, modperl_config_req_cleanup); modperl_interp_pool_set(r->pool, NULL, 0); interp->request=r; MpInterpPUTBACK_On(interp); MpReqCLEANUP_REGISTERED_On(rcfg); I think this turns a per-request interpreter into a per-handler one. I have attached a first version of an Apache2::Interpreter module that implements $r->interpreter->release. The most tricky part for me was to find the correct interp. Could you please have a look at that? Maybe it could be done much simpler. Also, the cleanup stuff is buggy as it is with scope==handler. $r->pool->cleanup_register works by locking the interp until pool cleanup. It thus blocks the interp from being reused. PerlCleanupHandler does not work at all. Torsten
  Approximate file size 3892 bytes
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )