There’s a problem with IPv6 route lookup speed in Linux

The challenge

The great thing about IPv6 is its larger IP address space, but this is also its weakness. That larger IP address space needs routing, potentially creating larger routing tables.. This creates larger routing tables, which has an impact on memory and the time taken to search them.

Work done by Vincent Bernat shows that an IPv6 route lookup takes 450ns for an IPv6 routing table containing 40,000 routes. This is longer that the time needed to forward a packet at 10Gb/s at wire-speed (50ns). Even with an empty table it takes 150ns to lookup where to send the packet.

This has a big impact when using Linux as a router in a 10Gb/s or higher environment. Because of the impact of larger routing tables, Linux uses a different route storage and lookup ability than IPv4. This, however, hasn’t been stress tested as much or as often as the corresponding code in the IPv4 environment.

What’s reviewed

He looks at the lookup implementation, the structures for storing the information and the code. He reviews the performance in three scenarios; that of a current Internet IPv6 full view, a data centre environment with various /48 routes in differing densities, and as a leaf router for an access model with /128 routes randomly spread through a /108 routing space.

He then tests these scenarios for route lookup performance, both in tree depth and lookup time. He measures performance in different kernel versions, and the performance inserting new routes into the table. Finally he looks at memory usage in the different scenarios.

Recommendations

There are a few recommendations, such as not using the CONFIG_IPV6_MULTIPLE_TABLES option in the kernel, and using a kernel later than version 4.2.

However, his main expectation is that as IPv6 usage increases, optimizations will occur in the code to speed up route lookup, and allow IPv6 packet forwarding at wire-speed for 10Gb/s.