Process Memory Buffer Allocation Mechanism-related to show Buffers

Source: Internet
Author: User
Tags trims cisco 2811
During the Cisco equipment inspection process, engineers are often asked to pay attention to the failures and misses output by show buffers. This document is written out of curiosity about the significance of buffer and its parameters. 1. Router data forwarding mechanism


1.1 Overview of forwarding mechanism

(1) process switching

For process-based forwarding, data traffic processing depends on RP (routing processor ).

(2) Fast Switching

Similar to the MLS technology, data traffic is a process-based forwarding method when it is first forwarded and must rely on RP.

When forwarding data for the first time, a forwarding cache is established, and then the forwarding of related data traffic is queried directly, instead of relying on RP.

(3) CEF

Build a fib and adjacency table based on information such as rib and ARP forwarding tables without relying on RP.

1.2 data forwarding process

The forwarding process of data to be processed by RP is described in detail here.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4B/3C/wKiom1Qo2qmzn-LGAADwZ__pWsI674.jpg "Title =" 01.png" alt = "wKiom1Qo2qmzn-LGAADwZ__pWsI674.jpg"/>

① Ingress traffic

When a port receives inbound traffic, the traffic must be forwarded to the RP for processing.

② Ask for Buffer

Interfaceprocessor sends a request to the RP to apply for a buffer in processormemory to be processed by the RP.

③ Response

RP replies based on the actual situation of processor memory.

If a buffer can accommodate the packet to be sent, it will be sent to the buffer of processor memory; otherwise, packet loss will occur.

2. Cisco Buffer Allocation Mechanism


2.1 buffer Overview


2.1.1 what is Buffer


650) This. length = 650; "src =" http://s3.51cto.com/wyfs02/M01/4B/3E/wKioL1Qo23HQSdCNAAFOc7lOVs0664.jpg "Title =" 02.png" width = "500" Height = "74" border = "0" hspace = "0" vspace = "0" style = "width: 500px; Height: 74px; "alt =" wkiol1qo23hqsdcnaafoc7lovs0664.jpg "/>

In a Cisco router, processor memory is divided into six pools of different sizes. Each pool contains blocks of the same size, which is called buffers.

2.1.2 buffer size in different pool types

① Small buffer -- 104 bytes

② Middle buffer -- 600 bytes

③ Big buffer -- 1536 bytes

④ Verybig buffer -- 4520 bytes

⑤ Large buffer -- 5024 bytes

⑥ Huge buffer -- 18024 bytes

2.1.3 relationship between pool and Buffer

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4B/3C/wKiom1Qo29Tic26fAAB-z7xxD0g830.jpg "Title =" 03.png" alt = "wKiom1Qo29Tic26fAAB-z7xxD0g830.jpg"/>

A pool may have the following situations:

(1) allocated space

In the allocated space, it is the created buffers that occupy the memory. These buffers may be waiting for packet to be processed, or they may be waiting for packet to enter.

(2) unallocated Space

Unallocated space indicates that this part of space does not have a buffer. When you need to create a buffer, you can divide the buffer for packet to use.

Note:

① The total amount of buffers that can be created in the pool is limited. This limit may come from the capacity of memory itself or from the Administrator's designation.

② The buffer is created on demand rather than fixed and full in the pool, so there is no fixed size in the pool.

③ The pool type determines the buffer size.

2.2 buffer request process 2.2.1 how to request interface Processor

Interfaceprocessor determines the buffer to be applied based on the packet size to be forwarded.

Packet size (unit: bytes) Requested buffer type
<104 Small Buffer
104 ~ 600 Middle Buffer
600 ~ 1536 Big Buffer
1536 ~ 4520 Verybig Buffer
4520 ~ 5024 Large buffer
5024 ~ 18024 Huge Buffer
2.2.2 how to handle routing Processor

(1)Scenario 1: the current pool has a free buffer.

RP authorizes the buffer to interface processor.

(2)Case 2: there is no free buffer in the current pool, but there is free space

① RP creates a buffer from free space.

② RP records a miss for the pool.

③ RP authorizes the buffer to interfaceprocessor.

(3)Case 3: No free buffer or freespace in the current pool

① RP records a miss for the pool.

② RP records a failure for the pool.

③ RP checks the pool of the next (larger) level to check whether a buffer can carry the packet.

Note:

If no buffer can be allocated at all levels of the pool, the process continues until the huge buffer is discarded. Failure does not mean packet loss.

2.3 related configurations 2.3.1 show

Showbuffers example:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4B/3C/wKiom1Qo3VORirYyAAORyreXma0352.jpg "Title =" 04.png" alt = "wkiom1qo3voriryyaaoryrexma0352.jpg"/>

Start counting from public buffer pools:

(1)The first line is related to the total number of buffers.

① Total

The total number of buffers in the current pool, including inusedbuffer and free buffer.

② Permanent

The number of buffers permanently stored in the pool. The number of buffers in the pool is directly affected by the permanent. The permanent should be considered as a lower limit of the total number of buffers.

(2)Row 2 -- free buffer related

① In Free List

The total number of free buffer records.

② Min

Specify the minimum number of buffers in the Free List. When the number of buffers is smaller than the min value, the RP will create the buffer actively.

③ Max allowed

The maximum number of buffers in the Free List is specified. When the number of buffers exceeds the max allowed value, the RP starts to actively trim the buffer.

Note:

① The total number of buffers is affected by the permanent parameter. Min and Max allowed affect the number of buffers in freelist.

② When the sum of inused buffer quantity and free buffer quantity does not exceed the buffer number specified by permanent, These buffers will not be trimmed even if the number of free buffer exceeds Max allowed.

③ When the min value is greater than the total number of buffers specified by permanent, the RP ensures that the number of free buffers must at least reach the buffer quantity specified by Min. In this case, the total number of buffers is directly affected by the min value.

(3)Row 3-buffer Processing

① Hits

When the current pool receives the buffer request, the hits value is accumulated. Hits intuitively reflects the utilization of six pools.

② Misses

When the buffer request is received and the pool does not have freebuffer available, misses accumulates.

③ Trims

Trims accumulates when the buffer is trimmed.

④ Created

When the RP creates a buffer, the created value is accumulated. When you receive a buffer request or the number of free buffers is less than min, the buffer may be created.

(4)Row 4-related to Buffer Allocation failure

① Failures

Failures accumulate when no free buffer is available and a new buffer cannot be created.

RP now transfers the packet to the next pool.

② No memory

When the buffer creation fails due to insufficient memory space, no memory is accumulated.

2.3.3 Configuration

(1) configure the buffer Parameters

Router (config )#Buffer small/middle... Permanent/min-free/max-free/initial <num>

Initial refers to the number of temporary buffer allocated when the device is started. this parameter is available because the device has the potential to establish a large number of control-level sessions when it is started, this kind of potential may all directly require RP processing. Therefore, before stable operation, it is reasonable to temporarily allocate a large number of buffers.

(2) how to clear buffer statistics

Currently, you can only restart the device.

2.4 Symptom Analysis

The show version and show buffers output for Cisco 2811 are as follows:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4B/3E/wKioL1Qo3lOg6Mp6AAGjHkpCdJE421.jpg "Title =" 05.png" alt = "wkiol1qo3log6mp6aagjhkpcdje421.jpg"/>


650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4B/3C/wKiom1Qo3juQUC2jAAIUnm0lSVE333.jpg "Title =" 06.png" alt = "wkiom1qo3juquc2jaaiunm0lsve333.jpg"/>

(1) symptom

As you can see, the current device experienced a buffer utilization peak at 7w0d and failures.

(2) traffic type determination

The device is Cisco 2811 and supports Cef and hardware forwarding. Failures starts with small buffers. Therefore, it can be inferred that the buffers utilization rate is high due to the excessive traffic of control plane.

(3) further analysis

When the peak value created by buffers appears at 7w0d, the device has run 1 year, 8 weeks. In the current status, a total of 191 buffers, of which 21 are free buffer. When the peak value is reached, the number of buffers is 264, And the status is 1.4 times higher. Therefore, it is inferred that this is caused by an emergency (such as a new enabling protocol or a new service ).

Because the processing control traffic and buffer creation depend on RP, we recommend that you reserve more small buffers in memory if you need to cope with unexpected situations to prevent high CPU utilization, at the expense of memory, the CPU is guaranteed.

3. Test-packet loss caused by insufficient buffer


3.1 environment overview


650) This. length = 650; "src =" http://s3.51cto.com/wyfs02/M01/4B/3C/wKiom1Qo3q2zjw_fAAD7QeIUn9c382.jpg "Title =" 07.png" width = "450" Height = "65" border = "0" hspace = "0" vspace = "0" style = "width: pixel PX; Height: 65px; "alt =" wkiom1qo3q2z1__faad7qeiun9c382.jpg "/>

(1) simulate the environment

IOU-WEB1.2.2-23

(2) topology Overview

① If the three vrouters are interconnected, run the command to ensure full network access.

② The serial ports R1, R2, and R3 all use the MTU command to adjust the MTU value to a maximum of 4072.

3.2 experiment ideas

(1) Objectives

By modifying the buffer value parameter of the intermediate forwarding vror2 R2. It is simulated that the actual traffic of R2.

(2) Make the packet size received by R2.

When a buffer cannot be created in a pool, packet is submitted step by step, ensure that the packet size received by R2 matches the pool with a high buffer capacity. Modify the MTU value of all device interfaces to the maximum value, this prevents the size of the traffic package actually received by R2 due to IP fragmentation.

On devices R1 and R3 that generate simulated traffic, specify the packet size to make the Generated Traffic as large as possible (at least reach the MTU of the Local interface)

(3) make R2.

Disable Cef and fast switching to prevent R2.

(4) Try to cause buffer shortage in R2

Adjust the permanent buffer, minbuffer, and Max allowed buffer of R2 to 0.

3.3 key steps

(1) Adjust MTU

R2 (config) # interfaces0/0

R2 (config-If) # mtu4072

(2) Disable Cef and fastswitching

R2 (config) # noip CEF

R2 (config) # interfaces0/0

R2 (config-If) # noip route-Cache

(3) Adjust the buffer Parameters

R2 (config) # buffersverybig permanent 0

R2 (config) # buffersverybig Min-free 0

R2 (config) # buffersverybig max-free 0

R2 (config) # bufferslarge permanent 0

R2 (config) # bufferslarge Min-free 0

R2 (config) # bufferslarge max-free 0

R2 (config) # buffershuge permanent 0

R2 (config) # buffershuge Min-free 0

R2 (config) # buffershuge max-free 0

(4) Ping between R1 and r3

R1 # ping31.31.23.3 repeat 1000000 size 18024

R3 # ping31.31.12.1 repeat 100000 size 18024

3.4 Experimental Phenomena

(1) R1 & r3

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4B/3C/wKiom1Qo32_xnKfIAAFrdg1JF9k554.jpg "Title =" 08.png" alt = "wkiom1qo32_xnkfiaafrdg1jf9k554.jpg"/>


650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/4B/3D/wKiom1Qo333QvlB7AAIIaicrmYQ770.jpg "Title =" 09.png" alt = "wkiom1qo333qvlb7aaiiaicrmyq770.jpg"/>

(2) R2 Phenomenon

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4B/3D/wKiom1Qo35GSHuPrAANo5WRTi2E116.jpg "Title =" 10.png" alt = "wkiom1qo35gshupraano5wrti2e116.jpg"/>

We can see that there are a large number of failures starting from verybig buffers, and this failures continues until huge buffers, resulting in the final packet loss.

(3) Enable CEF for R2

R2 (config) # ipcef

R1 and R3 after enabling:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4B/3F/wKioL1Qo3_HBmjf7AAK8YHbCrHU966.jpg "Title =" 11.png" alt = "wkiol1qo3_hbmjf7aak8yhbcrhu966.jpg"/>


650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4B/3F/wKioL1Qo3__CBNC9AANw591N1vA466.jpg "Title =" 12.png" alt = "wkiol1qo3104cbnc9aanw591n1va466.jpg"/>

It can be seen that after CEF is enabled, no packet loss will occur on R1 and R3.

R2 symptom:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4B/3D/wKiom1Qo3__ip5VPAANpDoMIuOo057.jpg "Title =" 13.png" alt = "wkiom1qo3104ip5vpaanpdomiuoo057.jpg"/>

After CEF is enabled, the verybigbuffer of R2 does not add hits, misses, and failures.

The reason for the above problem is that after CEF is enabled, ICMP traffic is directly forwarded through hardware instead of being processed by RP.


This article is from the "thely" blog, please be sure to keep this source http://thely.blog.51cto.com/2695427/1559343

Process Memory Buffer Allocation Mechanism-related to show Buffers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.