Configuring Busy Polling
Busy polling helps reduce latency in the network receive path by allowing socket layer code to poll the receive queue of a network device, and disabling network interrupts. This removes delays caused by the interrupt and the resultant context switch. However, it also increases CPU utilization. Busy polling also prevents the CPU from sleeping, which can incur additional power consumption.
Busy polling is disabled by default. To enable busy polling on specific sockets, do the following.
-
Set
sysctl.net.core.busy_poll
to a value other than0
. This parameter controls the number of microseconds to wait for packets on the device queue for socket poll and selects. Red Hat recommends a value of50
. -
Add the
SO_BUSY_POLL
socket option to the socket.
To enable busy polling globally, you must also set sysctl.net.core.busy_read
to a value other than 0
. This parameter controls the number of microseconds to wait for packets on the device queue for socket reads. It also sets the default value of the SO_BUSY_POLL
option. Red Hat recommends a value of 50
for a small number of sockets, and a value of 100
for large numbers of sockets. For extremely large numbers of sockets (more than several hundred), use epoll
instead.
Busy polling behavior is supported by the following drivers. These drivers are also supported on Red Hat Enterprise Linux 7.
-
bnx2x
-
be2net
-
ixgbe
-
mlx4
-
myri10ge
As of Red Hat Enterprise Linux 7.1, you can also run the following command to check whether a specific device supports busy polling.
# ethtool -k device | grep "busy-poll"
If this returns busy-poll: on [fixed]
, busy polling is available on the device.
其他链接
https://netdevconf.info/2.1/slides/apr6/dumazet-BUSY-POLLING-Netdev-2.1.pdf