httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <r...@imdb.com>
Subject Re: NameVirtualHost
Date Mon, 27 Oct 1997 19:29:54 GMT
On Mon, 27 Oct 1997, Dean Gaudet wrote:

> On Mon, 27 Oct 1997, Rob Hartill wrote:
> 
> > At what point does hashing become worthwhile ? - how big a table ?
> > and how many people are going to end up benefiting from a hash compared
> > to losing out from its overhead ?
> 
> The overhead of hashing an ip address is almost non-existant.  It's two
> shifts, two xors, and an and (the table size is a power of two so
> calculating the modulus doesn't involve doing a full division). 
> 
> The table is optimized for addresses which vary in the last octet, which
> should be essentially everyone. 
> 
> So a site with one vhost pays 5 binary ops and one memory lookup with this
> setup.  Whereas in a searching scheme they'd pay one memory lookup.  I
> suspect breakeven when you consider cache costs is between 1 and 2
> virtualhosts.  Honestly.  IP addresses are already numeric so calculating
> the hash is very trivial. 

The still leaves the other parameters, hostnames, ports, serverpath that
determine the actions to take.

> > I would expect the vast majority of configs to be simple enough to
> > implement in 0-5 lines using the '::' notation. Scanning such a
> > small table should be efficient compared to hash lookups.
> 
> I doubt it, your scheme involves at least 5 memory operations. 
> 
> > Straw poll, how many '::' lines would folks reading this mail need
> > for their configs ?
> 
> I really think your experiences with vhosts is limited to what you use --

it is.

> which is probably only a handful.  There are not many ISPs present on this
> list, so this poll is pointless.

My point is that these big ISPs are the exception and that most people
are far more likely to use minimal name based solutions.

Your hashing algorithm sounds fine. Use that as a first step in the
process - using the IP address hash to find which of the '::' style
tables to use to narrow the search down. Most people will only have
1 IP address so that first stage can be skipped.


rob


Mime
View raw message