减少网卡中断收包产生的CPU消耗

来源:互联网 发布:java nio netty 编辑:程序博客网 时间:2024/05/16 23:12

目标:减少网卡中断收包产生的CPU消耗。

优化的措施:

1,  减少收包的队列数:igb.RSS

2,  减少中断调用的次数:rx-usecs

 

Some useful tips:

1,  IGB driver requires the following parameter

igb.RSS

which demonstrates the number of Receive-Side Scaling (RSS)descriptor queues,in the case, it reduces from 8 to 5 which means enable 5 queues。

 

2,  rx-usecs

The parameterto modify are called interrupt coalescing parameters,  It is the number of usecs to wait beforeraising an RX interrupt after a packet has been received, when rx-usesc is setto 0 rx-frames is used.

  You may wish toreduce rx-usecs if latency is more important and you are using a low-latencyswitch or a point-to-point connection. Similarly, you may wish to increaserx-usecs if you are interested in reducing CPU overhead for large transfers.Note that rx-usecs controls both transmit and receive coalescing, In the case,it increases from 3 to 450.

 

How to view and edit it? You may use following tool:

ethtool –C eth1

to see the current size, and then use :

ethtool –C eth1 rx-usecs 450

to set the new value 450.

 

Valid range for rx-usecs are: 0,1,3, 10-8191

Specific meaning for each value as follows:

1,  0= off,  real-time interruption,  one package one interrupt, the lowest delay

2,  1=dynamic,which rangefor interrupts is 4000-70000

3,  3=dynamicconservative(default),which range for interrupts is 4000-20000

4,10-8191,how many microseconds every interruption will occurs. For example,you may wish to control the number of interrupt  in every second less than 1000 , then setrx-usecs to 1000000/1000=1000 microseconds, if less than 2000, then set it to1000000/2000=500

Since package is not processed in real time, side effect isadding some delays, such as, setting 500 microseconds for every interrupt meansmax delay is 500 microseconds and mean delay is about 250 microseconds.

 

 

0 0
原创粉丝点击