[Xorp-hackers] heavy CPU use for xorp_fea on startup

Ben Greear greearb at candelatech.com
Tue Mar 4 17:58:47 PST 2008


Pavlin Radoslavov wrote:
>> Looks like at least one problem is that we do a linear
>> lookup when searching for an interface by if-index.
>>     
>
> Absolutely correct. I am well aware of this issue
> and my intention was indeed to add an internal map to IfTree
> similar to what you suggest below.
> FYI, this method (and few other related methods) were added during a
> recent FEA refactoring and the initial emphasis was on correctness.
> Obviously, with the much smaller number of interfaces the rest of us
> we have to deal with, the performance optimization wasn't an urgent
> priority.
>
> In your implementation you need to be very careful that you capture
> all places inside IfTree that are related to the new pif_index to
> vif mapping.
>   
I was thinking on the way home:  Maybe just map if-index to if-name.  If 
the mapping
lookup fails, do a long slow linear lookup and if the object is found, 
add it to the if-index -> map.
If it succeeds, then lookup the vif by way of the existing hash, 
double-check the if-index is
correct (if not, do a slow lookup).

I'll also update the if-index -> if-name hash when a vif is added so at 
least most of the
time we shouldn't have to do a slow lookup.

This should keep us from having to worry about stale memory references to
vifs that might have been deleted, while giving good scaling lookups.

Sound legit?

Ben

-- 
Ben Greear <greearb at candelatech.com> 
Candela Technologies Inc  http://www.candelatech.com




More information about the Xorp-hackers mailing list