Small Forwarding Tables for Fast Routing Lookups
description
Transcript of Small Forwarding Tables for Fast Routing Lookups
Presenter: Shin, Byoungheon
Introduction Routing and Forwarding tables Design goals and parameters Data Structure Performance measurements Scaling Conclusion
Larger network size (Internet) and Faster network speed
IP routing lookup in software level◦ …Possible?◦ Most think software IP routing lookup cannot
come up with the speed of Gigabit network.
Routers
Local version of routing table
Local version of routing table
Traditional implementations of routing tables use Patricia trees.◦ More than 2MB
How about very small and fast forwarding table?◦ 40,000 routing entries, 150-160KB size
Purpose◦ Software IP routing lookup on the general purpose
processors(Alpha 21164 333MHz, Pentium Pro 200MHz)
Routing table◦ Determines next hop for IP datagrams◦ Updated frequently (dynamic)
Forwarding table◦ Local version of routing table◦ Can be optimized for “lookup speed”
Goal◦ Minimize lookup time◦ Minimize two parameters:
The number of memory accesses during lookup The size of data structure
◦ The data structure: Need few instructions during lookup Keep the entities naturally aligned as much as possible to
avoid expensive instructions and cumbersome bit-extraction operations
The forwarding table◦ Binary tree covering all IP addresses
Rule of the longest match◦ When several routing entries cover the same IP
address
Routing entry e1 is hidden by e2 for addresses in the
range r.
Forwarding table◦ Representation of the binary tree spanned by all
routing entries◦ Prefix tree (trie)
should be complete
Three levels of the data structure◦ Level 1: 16 bits◦ Level 2: 8 bits◦ Level 3: 8 bits
Core result◦ can represent a complete binary tree of height h
using only one bit per possible leaf at depth h, plus one base index per 64 possible leaves, plus the information stored in the leaves.
◦ The size of a tree in bytes with l leaves holding information of size d is:
2h-3 + b × 2h-6 + l × d
(b: size of a base index)
Level 1◦ Initial 16 bits of IP address: used for an index◦ Depth is 16. (binary tree)◦ 1 – 64K(216) children◦ Leaves in depth 16: bit vector
Level 1 cont’d◦ Heads: Nodes in depth 16 if existing
Or, the lowest bit in the interval covered by that leaf is set.
◦ A bit in the bit vector: A one representing a root head A one representing a genuine head Zero which means this value is a member of a range
covered by a leaf at a depth less than 16
Level 1 cont’d
Root headGenuine
head
Level 1 cont’d◦ Head information
Root head: index to the level 2 chunk that represents the corresponding subtree
Genuine head: index into the next-hop table Encoded in 16-bit pointers stored in an array
2 bits: the kind of pointer 14 bits: index into next-hop or index into an array
Level 1 cont’d◦ Finding pointer groups
An array of codewords as many as bit-masks An array of base indices, one per four code words: to find a
group of pointers Codeword: 10 bit value(r1, r2, …) + 6 bit offset(0,3,10, …)
Level 1 cont’d◦ Maptable
To find the correct pointer in the group of pointers Bit-masks are generated from a complete prefix tree, not all
combinations of the 16 bits are possible. Non-zero bit-mask of length 2n: combination of two bit-
masks of length n or bit-mask with value 1
Level 1 cont’d◦ Searching
Levels 2 and 3◦ Chunks: A chunk covers a subtree of height 8 and
can contain at most 28=256 heads.◦ 3 kinds of chunks
1-8 heads: the chunk is “sparse.” 9-64 heads: the chunk is “dense.” 65-256 heads: the chunk is “very dense.”
Levels 2 and 3 cont’d◦ Sparse: array of 8-bit indices of the heads◦ Dense: just one base index for all 16 codewords◦ ‘Dense and very dense’ chunks are searched
analogously with the 1st level.
Growth limitations◦ The number of chunks of each kind is limited to
214=16384.◦ The number of pointers in levels 2 and 3 is limited
by the size of base indices.◦ The number of distinct next-hops is limited to
214=16384.
◦ BUT, with small modifications, it can accommodate a large increase in number of routing entries.
Many routing tables◦ Collected through the Internet (IPMA project)
Very few. Searching one level takes 4 memory accesses.
Mostly less than 8 memory accesses
Lookup times◦ Alpha 21164: at least 2.2 million lookups /sec◦ Pentium Pro: at least 2.0 million lookups /sec
Forwarding table size
Table building time◦ The table is built during a single pass over all
routing entries. Larger addresses
◦ IPv6 possible inflating table size
Compact forwarding table◦ Searched quickly to find the longest matching
prefix.
Resides in the cache of general purpose CPUs.
Can scale to accommodate the growth in routing table size.
Thank you!