Saturday, August 3, 2013

RPS and RFS: The cool stuffs behind efficient network load across Multi-Core CPUs.

Abstract
Networks (including Internet) are inevitable part of our life. Life without network is life without”live” for many of us. But are these networks really meet our requirements, especially when we dealing with Multi-Cores? Let’s have a look into the cool stuffs which makes the network loads better across Multi-Cores CPUs.
Introduction
Networks become unavoidable part of our life since from its birth. Even at this age of huge-storage flash drives, we still prefer to use networks for most of the daily tasks. This makes a huge question when it comes to Multi-core CPU systems. How efficiently we can use the network by dividing the network overload across the CPUs? Well the answer is not quite simple!
Network cards bandwidth is vastly improved in such a way that single core can’t manage the network load. The beauty of Multi-Core technology is that it can offer advantage in both performance and overall system efficiency. But how network load can take the advantage of it?
The answer came from the search giant Google! Google provided two new features from Linux kernel 2.6.35 onwards, namely, Receive Packet Steering (RPS) and Receive Flow Steering (RFS) will resolve this issue in a better way. RFS is an extension of RPS. What these technology does is, it identify the network overload and balances that across the number of cores on the system in-order to increase the performance level.
The advantage of using RFS and RPS includes but not limits to the following
1.      This technology almost tripled network performance while doubling overall system utilization.
2.      Efficient.
3.      Effective utilization of cache.
4.      Allow protocol processing in parallel.
5.      Lower latency.
6.      Supports both single queue and multiqueue cards.
7.      Implemented in Linux and taking every advantage of Linux environment including free contributing.
How RFS and RPS works?
Receive Packet Steering (RPS): RPS can distribute the network load of received packet processing into multiple cores. This technology allows protocol processing (ex. TCP/IP) to be done on packets in parallel. The mapping can be done through a proper hash table mechanism. For each receive queue, a particular hash packet header is using to index into a mask of CPUs. RPS will also decide which CPU core has to perform a specific network queue.

Receive Flow Steering (RFS): RFS is an extension technology to RPS. The random choice of CPU selection with RPS may not fulfill the requirement sometimes. The random choice is not better in terms of better utilization. Moreover, if the random selected CPU core is overloaded with the other tasks, then the situation become worst. To avoid these issues, RFS come into picture. Instead of choosing a random CPU core, RFS will choose a CPU core where the application running the “recvmsg()” system call is running or has run in the past, to improve cache utilization. This will help to process the loads quickly by fetching the proper information in a better way.
Conclusion
RFS and RPS are two new technologies which makes efficient utilization of network load across Multi- Cores in a system. RFS and RPS play a vital role in the receiving side and is playing a key role from Linux kernel 2.6.35 onwards. Though the technology is already implemented from the 2.6.35 kernel onwards, it’s totally up to the developer to select these technologies into action.

Reference:
Linux 2.6.35 release page: