Thursday, January 16, 2020

TCAM inside routers

Links referred:
 http://www.enterprisenetworkingplanet.com/netsysm/article.php/3527301/On-Your-Network-What-the-Heck-is-a-TCAM.htm

https://howdoesinternetwork.com/2015/tcam-memory

https://www.metaswitch.com/blog/save-some-cache.-trash-the-tcam

http://slideplayer.com/slide/15897722/


TCAM is a Ternary CAM. This allows the operating system to match a third state, "X." The X state is a "mask," meaning its value can be anything.

 

This lends itself well to networking, since netmasks (define) operate this way. To calculate a subnet address we mask the bits we don't care about, and then apply the logical AND operation to the rest. Routers can store their entire routing table in these TCAMs, allowing for very quick lookups.

Besides Longest-Prefix Matching, TCAM in today’s Routers and Multilayer Switch devices are used to store ACL, QoS and other things from upper-layer processing. TCAM architecture and the ability of fast lookup enables us to implement Access-Lists without an impact on router/switch performance.

Devices with this ability mostly have more TCAM memory modules in order to implement Access-List in both directions and QoS at the same time at the same port without any performance impact. All those different functions and their lookup process towards a decision is made in parallel.



Pros:

1. Works faster as compared to same logic if written in SW

 2. TCAM main characteristic is that it is able to search all its entries in parallel. It means that no matter how many address prefixes are stored in TCAM, router will find the longest prefix match in one iteration.

3. TCAM's performance is deterministic

4. Updating TCAM based entries is easy


Cons:

1. The additional circuitry, required to perform the comparative detection, means chips having TCAM are not cheap, rather very expensive

2. TCAM memory is very power hungry. It's size and the nature of its parallelism (i.e the fact that each comparative circuit is firing simultaneously on each clock cycle) results in it drawing significantly more power and generating considerably more heat than typical RAM.


Alternatives to TCAM:


1. A software-based session border controller can make use of level 3 cache to perfectly replicate the functionality of a TCAM while making use of HASH/TRIE etc based solutions which are a little tough to implement

Points to remember:

1.  IP prefixes need to be sorted before they are stored in TCAM so that longest prefixes are on upper position with higher priority (lower address location) in a table. This enables us to always select the longest prefix from given results an thus enables Longest-Prefix Matching.






No comments:


Mindbox