You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by pe...@webcom.com on 1998/09/18 20:29:00 UTC

A couple of Apache architecture questions

I'm pretty familiar with the NSAPI, having hacked quite a few modules.
I'm in the process of porting a module to Apache, and I had a couple
of questions for the Apache developers:

First:

I was looking at the ap_table_get() function and noticed that the internal
structure of Apache tables appears to be a calloced array.  I'm familiar 
with Netscape architecture, and they use hash tables for storing all the 
header and such.  This makes it easier on the module programmer and faster 
for doing indexed lookups on strings, etc.

So, here's the question:  Is there a specific reason why Apache does not
implement hash tables for the table structures?

Second:

Netscape provides a function called pblock_str2pblock() which takes a
string like "name=value name=value" and converts it into a pblock (hashtable).

Does Apache have a similar function, for converting query strings into tables?

Thanks,

--Perry

-- 
Perry Harrington        System Software Engineer    zelur xuniL  ()
http://www.webcom.com  perry.harrington@webcom.com  Think Blue.  /\


Re: A couple of Apache architecture questions

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
pedward@webcom.com wrote:
> 
> So, here's the question:  Is there a specific reason why Apache does not
> implement hash tables for the table structures?

Dean looked at that several months ago and found there was no
appreciable performance improvement.  To everyone's surprize.

#ken	P-)}

Ken Coar                    <http://Web.Golux.Com/coar/>
Apache Group member         <http://www.apache.org/>
"Apache Server for Dummies" <http://Web.Golux.Com/coar/ASFD/>

Re: A couple of Apache architecture questions

Posted by Dean Gaudet <dg...@arctic.org>.

On Fri, 18 Sep 1998 pedward@webcom.com wrote:

> So, here's the question:  Is there a specific reason why Apache does not
> implement hash tables for the table structures?

It isn't faster.  I don't remember when I did it, but sometime in the last
year I converted the tables to hash tables and there was no appreciable
win.

Dmitry Khrustalev has done a perfect hash for things like headers,
including "interning" the constants we use (i.e. "Content-Type",
"Content-Length", ...) so that we only need to compare pointers... and I
believe it's a win, but he didn't post results.  It requires a few more
API changes though. 

> Netscape provides a function called pblock_str2pblock() which takes a
> string like "name=value name=value" and converts it into a pblock (hashtable).
> 
> Does Apache have a similar function, for converting query strings into tables?

No, but it would be useful.

Dean


Re: A couple of Apache architecture questions

Posted by Rasmus Lerdorf <ra...@lerdorf.on.ca>.
> I was looking at the ap_table_get() function and noticed that the internal
> structure of Apache tables appears to be a calloced array.  I'm familiar 
> with Netscape architecture, and they use hash tables for storing all the 
> header and such.  This makes it easier on the module programmer and faster 
> for doing indexed lookups on strings, etc.
> 
> So, here's the question:  Is there a specific reason why Apache does not
> implement hash tables for the table structures?

You probably have a point on the speed issue, but I fail to see how it
would be easier with a hash table.  ap_table_get() looks like a hashed
lookup to a module programmer.  

eg.

   content_type = table_get(r->subprocess_env, "CONTENT_TYPE");

> Netscape provides a function called pblock_str2pblock() which takes a
> string like "name=value name=value" and converts it into a pblock (hashtable).
> 
> Does Apache have a similar function, for converting query strings into tables?

No, there is no such function.  I think this is a very module-specific
thing.  I don't see how a general-purpose function could be written that
would be useful to more than a handful of modules.

-Rasmus