"RewriteMap"s inefficient (was: [Zope-dev] Apache Mod_rewrite question)

Ganesha Shanmuganathan sganesh at zeomega.com
Wed Jul 14 18:26:28 EDT 2004


Hi,

On Wed, 2004-07-14 at 13:50, Dieter Maurer wrote:
> Ganesha Shanmuganathan wrote at 2004-7-13 16:40 -0500:
> > ...
> >The directive RewriteMap has unexpected behavior when it is used to
> >define more than one map with same map name in diffrent places. Normally
> >all the directives within a tag applies only to that tag. 
> 
> There are more strange things with Apache's "RewriteMap"s.
> Be warned: they are very inefficiently implemented for large maps!
> 
>   We used such maps to let Apache serve static CMF content
>   as folkore reports that Apache is an order of magnitude
>   faster than Zope in serving static content.
> 
>   It turned out that the solution using Apache RewriteMaps was 
>   slower than directly serving this content from Zope --
>   by a factor of 5!
> 
>   The explanation: Apache caches only single successful lookups
>   in the map file. Each access to a key not in the cache
>   results in parsing the map file until the key is found -- the
>   whole map file when it does not contain the key.
>   For larger map files, this has desastrous effects.
> 
> Now, we use RewriteMaps only when the map files are very small
> (not more than some dozen entries).
That is interesting to know. Right now, we use multiple map files but
each is small. Is there anyother way to do load balncing with Zope
without Rewrite ?
> 
> > ... maps with the same name ...
> >The problem is the cache treats both the file as the same since they
> >have the same name! Hence if you visit foo.com first, the data stored in
> >foomap.txt is returned from the cache next time you visit foo.com or
> >bar.com. This causes apache to redirect into the wrong zope site.
> 
> We did not observe this behaviour...
btw, Did you use the same map name (like, in different sections maybe)
for the different map files. That is what is causing it to fail. It is
not a big issue but just wanted to confirm. Directives within one
<Virtualhost> tag should not have any effect on others. 

thanks,
ganesh

Zeomega LLC
Open minds' Open Solutions

Plano, Texas, USA
Bangalore, India
phone: 972-731-6750
http://www.zeomega.com



More information about the Zope-Dev mailing list