[Zope] efficient internal redirect
Alexander Staubo
alex@mop.no
Mon, 13 Mar 2000 12:50:32 +0100
> From: cmsakh@zope.org [mailto:cmsakh@zope.org]On Behalf Of Andy Heath
> Sent: Monday, March 13, 2000 11:50 AM
> To: alex
> Cc: zope@zope.org
> Subject: Re: [Zope] efficient internal redirect
>
> > Why can't they be the one and the same? Redirector is fast
> -- I suspect
> > the difference in speed between Redirector and something
> else would be
> > negigible.
>
> I confess, what you have is a very good idea. The reason I'm
> hesitating
> is because there won't be two or three areas and its wrong to call
> them areas. They will be single documents and a little bit
> further down
> the
> road there may be hundreds of them needed and not in any homogenous
> flat structure but at different places in a tree. Also,
> I really do need every last inch of speed out of this part.
Why not derive a specialized version of my product ("Redirector Method")
that descends from not Folder, but SimpleItem? If each such method
represents only a single "mapping", you get what you ask for.
Of course, if you have plugged your Zope into Apache, then it would be
more efficient to use mod_rewrite anyway.
> Some questions:
>
> 1. does your product redirect back to the client or within zope?
Yes. It forces an HTTP redirect. I don't if Zope is re-entrant; that is,
whether you can emulate symbolic links by passing the request, modified,
back into Zope.
> 2. assuming it were hardwired as you suggest what would be the runtime
> cost over just having folder methods in zope do the redirection?
Not sure if the word "hardwired" is correct here. After all, what I just
described to you in the previous email was not about changing the
product itself -- that's hardwiring -- but changing the parameters to
the product's *folder instance* -- that's Zope. ;-)
What I suggested about using a dict for non-regexp mappings does not
involve any hardwiring, either -- I meant patching the product to
support dicts *in addition* to the existing regexps. Basically in the
folder's management interface you'd simply specify whether a mapping
used a regexp or not.
Runtime cost: You would have to time it. Marginal, unless you're
expecting a gazillion hits.
> 3. I haven't touched python for 2 years now (though I did use it a lot
> then) - I'm very rusty. Could you supply a patch to hardwire in a
> dictionary
> instead of the regex code? Assuming 2. is satis this *could*
> be a good
> answer.
Let me think about it. I'm pretty busy -- perhaps Dylan is up to the
task, he did the previous patch.
> 4. still looking for an answer to my orginal q - what's the most
> efficient way?
mod_rewrite.
Alexander Staubo
mailto:alex@mop.no
http://www.mop.no/~alex/