본문 바로가기
server/Cent_os

Centos NIC ring buffer size 조절

 리눅스에서는 패킷 송수신시 1계층 물리적 케이블을 통하여 NIC로 packet이 수신 되면 가장 먼저 Ring Buffer 라는 영역에 보관한 뒤에
처리 된다. 





# Ring Buffer (Circular buffer) 구조

- FIFO 기반의 일반적인 선형 큐의 메모리가 꽉 차게되면 Overflow가 발생 하지만 원형(환형)의 형태로 머리와 꼬리?
가 붙어 있는 형태의  큐를 구성 하여 dropped 되어 유실되는 packet 을 방지 한다.




기본적으로 ethtool -g 명령어로 확인이 가능하다.

# ethtool -g 명령어의 man
-g --show-ring :Queries the specified network device for rx/tx ring parameter information.

[root@CY3 ~]# ethtool -g eth1
Ring parameters for eth1:
Pre-set maximums:
RX:             4096
RX Mini:        0
RX Jumbo:       0
TX:             4096
Current hardware settings:
RX:             256
RX Mini:        0
RX Jumbo:       0
TX:             256

위 예제에서 eth1 maximum 으로 처리 가능한 ring buffer size 는 4096 이며, Current 로 설정 되어 있는 값는 256 이다.
리눅스 상에서packet 의 drop 과 error 를 줄이기 위해서 maximum 과 Current  동일하게 설정 하는 것이 좋다.
ethtool -G 명령어에 해당 파라미터를 maximum 값과 동일하게 설정 한뒤 설정 값을 변경한다.

# ethtool -G 명령어의 man
ethtool -G|--set-ring devname [rx N] [rx-mini N] [rx-jumbo N] [tx N]

[root@CY3 ~]# ethtool -G eth1 rx 4096
[root@CY3 ~]# ethtool -g eth1
Ring parameters for eth1:
Pre-set maximums:
RX:             4096
RX Mini:        0
RX Jumbo:       0
TX:             4096
Current hardware settings:
RX:             4096
RX Mini:        0
RX Jumbo:       0
TX:             256

해당 ethtool 명령어는 재부팅뒤 설정이 초기화 되기 때문에 rc.local 에 추가하여 재부팅 시에도 적용 될 수 있도록 한다.

[root@CY3 ~]# echo "ethtool -G eth1 rx 4096 " >> /etc/rc.local


반응형