INN with hyperthreading/SMP
rra at stanford.edu
Fri May 14 02:59:17 UTC 2004
Forrest J Cavalier <mibsoft at epix.net> writes:
> That isn't what I saw when I looked at the comments or the code at
> entry_find_oldest(void *data, void *cookie)....
> ** Called by hash_traverse, this function finds the oldest entry with the
> ** smallest refcount and stores it in the provided pointer so that it can be
> ** freed. This is used when the cache is full to drop the least useful
> ** entry.
The comment is mildly confusing. What's being freed is the entry in the
cache hash table, not the overview struct itself. It just drops out of
the cache, which means that when the user of that overview group closes
it, it's freed rather than living on in the cache.
The refcount may not be entirely right, since I didn't actually think
about multithreading the code when I was writing it, but I don't think
there are any fundamental obstacles. One may have to move the refcount
into the object itself rather than the cache wrapper, though.
> I also seem to recall that when I pthread'ed nnrpd, the TDX code really
> didn't look too promising. You can increase the cache slots, but the
> cache maintenance looked expensive. Maybe not O(n*n), but I don't
> remember exactly.
I didn't spend a lot of time on the cache; I can readily believe that
could be improved considerably. (I also think that INN is in general
using a too-expensive hash function, but I've not done a lot of
investigation there.) Plus, caching in a multithreaded application is a
fundamentally different sort of problem.
One structural change that would probably be useful for multithreaded use
is to move the refcount from the cache object to the actual index object
itself and just have the cache be another reference to it.
> I do have an nnrpd completely pthreaded, but never ran under full load.
> (I think the trouble was that all the MMAPing of .IDX files was hitting
> the available memory limit for a 32-bit address.)
Yeah, that's going to be a problem.
Russ Allbery (rra at stanford.edu) <http://www.eyrie.org/~eagle/>
Please send questions to the list rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
More information about the inn-workers