httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <>
Subject Re: NameVirtualHost
Date Mon, 27 Oct 1997 18:52:11 GMT

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. 

> 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 --
which is probably only a handful.  There are not many ISPs present on this
list, so this poll is pointless. 

But for what it's worth,'s config would take 16.  12
name-vhosts, and 3 ip-vhosts, plus the default case.

Depending on which hotwired server you pick you'd get between 20 and 50.

If you go to a real ISP you'll see 500+. 


View raw message