Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use RSS to improve the performance of DPDK applications

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, Xiaobian will bring you about how to use RSS to improve the performance of DPDK applications. The article is rich in content and analyzes and narrates from a professional perspective. After reading this article, I hope you can gain something.

what is RSS

RSS(Receive Side Scaling) is a network card driver technology that can efficiently distribute received messages among multiple CPUs in multiprocessor systems.

The NIC parses the received message to obtain IP address, protocol and port quintuple information.

The network card calculates the HASH value according to the five-tuple information through the configured HASH function, and can also calculate according to the two-tuple, three-tuple or four-tuple.

Take the lower bits of the HASH value (this specific network card may be different) as the index of RETA(redirection table)

Distribute to corresponding CPU according to value stored in RETA

The following diagram describes the complete process flow:

RSS technology-based programs can distribute data streams among multiple CPUs through hardware and can implement dynamic Load Balancer through modifications to RETA.

Configuring RSS in DPDK

DPDK supports setting static hash values and configuring RETA. However, RSS in DPDK is port-based and distributes messages according to the receiving queue of the port. For example, if we configure 3 receive queues (0,1,2) on a port and enable RSS, then this is what happens in:

{0,1,2,0,1,2,0.........}

Applications running on different CPUs receive messages from different receive queues, thus achieving the effect of message distribution.

In DPDK, enable RSS by setting the mq_mode field in rte_eth_conf, rx_mode.mq_mode = ETH_MQ_RX_RSS.

When RSS is enabled, the hash value calculated by RSS will be stored in rte_pktmbuf corresponding to the message, which can be accessed through pktmbuf.hash.rss. This value can be used directly in subsequent message processing without recalculating hash values, such as fast forwarding, identifying message flows, etc.

RETA is configurable at runtime so that applications can dynamically adjust message distribution by changing the receive queue corresponding to the CPU. This is configured via the PMD module drivers, such as ixgbe_dev_rss_reta_update and ixgbe_dev_rss_reta_query.

Symmetric RSS

In network applications, if two-way messages of the same connection are distributed to the same CPU after RSS is enabled, this RSS is called symmetric RSS. Symmetric RSS is a great performance boost for web applications that need to save some information for connections. If bi-directional messages for the same connection are distributed to different CPUs, then sharing information about the connection between the two CPUs involves locks, which obviously affect performance.

RSS generally uses Toeplitz hash algorithm, which has two inputs: a default hash key and five-tuple information extracted from the message. The default hash key used by DPDK is recommended by Microsoft. See lib/librte_pmd_e1000/igb_rxtx.c:1539 for the specific definition. The hash value calculated by using this default value in different directions of the same connection is different.

Specifically, the hash values calculated by {src: 1.1.1.1, dst: 2.2.2.2, srcport: 123, dstport: 456} and {src: 2.2.2.2, dst: 1.1.1.1, srcport: 456, dstport: 123} are different. If the hash values are different, the messages in the two directions will be distributed to different receiving queues and processed by different CPUs.

If you want to achieve the effect of symmetric RSS, you need to replace the hash key currently used by DPDK with another hash key.

Here is the hash key value.

static uint8_t rss_intel_key[40] = { 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, };

The above is how to use RSS to improve the performance of DPDK applications shared by Xiaobian. If you happen to have similar doubts, you may wish to refer to the above analysis for understanding. If you want to know more about it, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report