Showing posts with label queues. Show all posts
Showing posts with label queues. Show all posts

Wednesday, February 2, 2022

What is Weighted Random Early Detection? How to configure WRED?

 Queuing mechanisms we have discus like LLQ is about managing the front of our queues. RED (Random Early Detection) is about managing the tail of our queue.

When a queue is full, IOS has no place to put newly arriving packets, so it discards them this phenomenon is called tail drop.

by default, queues use their maximum size, and then if any new packets arrived it will discard them until there is space again in the queue. yes dropped packets may cause significant application performance degradation when the router interface experiences congestion when the output queue is full. 



 Tail drop is bad for the overall network, especially for TCP traffic, and especially for TCP because when packets are lost, for whatever reason, TCP senders slow their rate of sending data. When tail drops occur and multiple packets are lost, the TCP connections slow even more. 

The TCP window size increases automatically but when TCP segments are dropped, it reduces back to one segment. The window size then grows exponentially until it reaches half the window size of what it was when the congestion occurred. The TCP window size then grows linearly. This process is called a slow start. Meaning that the overall network load tends to drop after multiple packets are tailed dropped. 

Interestingly, overall throughput can be improved by discarding a few packets as queues begin to fill, rather than waiting for the larger impact of tail drops. cisco created weighted random early detection (WRED). Weighted random early detection Cisco iso deployment of red Add weight (precedence / DSCP) Selectively prefer to drop packets with lower QoS markings. Can be applied on the interface or class level.

 Now the question is how WRED works?



 

 

Whenever the average queue depth is below the minimum threshold (20), WRED will not drop any packets at all. Until the average queue depth is above the minimum threshold (20), WRED will start to drop a small number of any (random) packets. If the average queue depth increases, even more, WRED will start dropping a larger percentage of random packets until it will reach the maximum threshold (45). If the average queue depth reaches the maximum threshold (45), WRED drops all packets. The MPD (25%) is the number of packets that WRED drops when we hit the maximum threshold (45).

MPD (mark probability denominator) IOS calculates the discard percentage used at the maximum threshold based on the simple formula 1/MPD.

Enough talk now. Let’s see how to configure WRED with IP Precedence and DSCP this tech.


Topology:




Goal: 

  • configure the topology as per the diagram 
  • configure IP addresses to their ports as per the topology 
  • configure OSPF 1 routing between router 1 and router 2
  • configure WRED default MPD (mark probability denominator)
  • configure WRED using IP precedence on router 1 with the following terms.

1. traffic marking with IPP value 0 and 1 allow 22 percent bandwidth 

2. traffic marking with IPP value 2 and 3 allow 27 percent bandwidth

3. traffic marking with IPP value 4 and  allow 30 percent bandwidth


R1(config)#interface serial 4/0

R1(config-if)#ip address 192.168.1.1 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#exit


R1(config)#interface fastEthernet 0/0

.R1(config-if)#ip address 172.16.1.1 255.255.0.0

R1(config-if)#no keepalive

R1(config-if)#no shutdown

R1(config-if)#exit


R1(config)#interface loopback 0

R1(config-if)#ip address 10.1.1.1 255.0.0.0

R1(config-if)#no shutdown

R1(config-if)#exit



R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 172.16.1.2 255.255.0.0
R2(config-if)#no keepalive
R2(config-if)#no shutdown
R2(config-if)#exit

R2(config)#int loopback 0
R2(config-if)#ip address 20.1.1.1 255.0.0.0
R2(config-if)#no shutdown
R2(config-if)#exit


R1(config)#router ospf 1

R1(config-router)#network 192.168.1.0 255.0.0.0 area 0

R1(config-router)#network 172.16.0.0 255.255.0.0 area 0

R1(config-router)#network 10.0.0.0 255.255.255.0 area 0

R1(config-router)#exit


*Feb  2 13:15:23.675: %OSPF-5-ADJCHG: Process 1, Nbr 20.1.1.1 on Serial4/0 from LOADING to FULL, Loading Done

R2(config)#router ospf 1
R2(config-router)#network 192.168.1.0 255.0.0.0 area 0
R2(config-router)#network 172.16.0.0 255.255.0.0 area 0
R2(config-router)#network 10.0.0.0 255.255.255.0 area 0
R2(config-router)#exit


*Feb  2 13:15:01.195: %OSPF-5-ADJCHG: Process 1, Nbr 10.1.1.1 on Serial4/0 from LOADING to FULL, Loading Done



R1(config)#class-map WRED0_1

R1(config-cmap)#match ip precedence 0 1

R1(config-cmap)#exit


R1(config)#class-map WRED2_3

R1(config-cmap)#match ip precedence 2 3

R1(config-cmap)#exit


R1(config)#class-map WRED4_5

R1(config-cmap)#match ip precedence 4 5

R1(config-cmap)#exit



R1(config)#policy-map prec_WRED

R1(config-pmap)#class WRED0_1

R1(config-pmap-c)#bandwidth percent 22

R1(config-pmap-c)#random-de

R1(config-pmap-c)#random-detect ?

  atm-clp-based                   Enable atm-clp-based WRED as drop policy

  clp                             parameters for each clp value

  cos                             parameters for each cos value

  cos-based                       Enable cos-class-based WRED as drop policy

  discard-class                   parameters for each discard-class value

  discard-class-based             Enable discard-class-based WRED as drop

                                  policy

  dscp                            parameters for each dscp value

  dscp-based                      Enable dscp-based WRED as drop policy

  ecn                             explicit congestion notification

  exponential-weighting-constant  weight for mean queue depth calculation

  precedence                      parameters for each precedence value

  precedence-based                Enable precedence-based WRED as drop policy

  <cr>


R1(config-pmap-c)#random-detect

R1(config-pmap-c)#random-detect precedence 0 20 40 10

R1(config-pmap-c)#random-detect precedence 1 24 40 10

R1(config-pmap-c)#exit


R1(config-pmap)#class WRED2_3

R1(config-pmap-c)#bandwidth percent 27

R1(config-pmap-c)#random-detect

R1(config-pmap-c)#random-detect precedence 2 26 40 10

R1(config-pmap-c)#random-detect precedence 3 29 40 10

R1(config-pmap-c)#exit


R1(config-pmap)#class WRED4_5

R1(config-pmap-c)#bandwidth percent 30

R1(config-pmap-c)#random-detect

R1(config-pmap-c)#random-detect precedence 4 31 40 10

R1(config-pmap-c)#random-detect precedence 5 33 40 10

R1(config-pmap-c)#exit

R1(config-pmap)#exit


R1(config)#interface serial 4/0

.R1(config-if)#service-policy output prec_WRED

R1(config-if)#

R1(config-if)#exit










R1#show policy-map interface serial 4/0
 Serial4/0

  Service-policy output: prec_WRED

    Class-map: WRED0_1 (match-all)
      0 packets, 0 bytes
      5 minute offered rate 0000 bps, drop rate 0000 bps
      Match: ip precedence 0  1
      Queueing
      queue limit 64 packets
      (queue depth/total drops/no-buffer drops) 0/0/0
      (pkts output/bytes output) 0/0
      bandwidth 22% (339 kbps)
        Exp-weight-constant: 9 (1/512)
        Mean queue depth: 0 packets
        class       Transmitted         Random drop      Tail drop          Minimum        Maximum     Mark
                pkts/bytes            pkts/bytes       pkts/bytes          thresh         thresh     prob

        0               0/0               0/0              0/0                 20            40  1/10
        1               0/0               0/0              0/0                 24            40  1/10
        2               0/0               0/0              0/0                 24            40  1/10
        3               0/0               0/0              0/0                 26            40  1/10
        4               0/0               0/0              0/0                 28            40  1/10
        5               0/0               0/0              0/0                 30            40  1/10
        6               0/0               0/0              0/0                 32            40  1/10
        7               0/0               0/0              0/0                 34            40  1/10

    Class-map: WRED2_3 (match-all)
      0 packets, 0 bytes
      5 minute offered rate 0000 bps, drop rate 0000 bps
      Match: ip precedence 2  3
      Queueing
      queue limit 64 packets
      (queue depth/total drops/no-buffer drops) 0/0/0
      (pkts output/bytes output) 0/0
      bandwidth 27% (416 kbps)
        Exp-weight-constant: 9 (1/512)
        Mean queue depth: 0 packets
        class       Transmitted         Random drop      Tail drop          Minimum        Maximum     Mark
                pkts/bytes            pkts/bytes       pkts/bytes          thresh         thresh     prob

        0               0/0               0/0              0/0                 20            40  1/10
        1               0/0               0/0              0/0                 22            40  1/10
        2               0/0               0/0              0/0                 26            40  1/10
        3               0/0               0/0              0/0                 29            40  1/10
        4               0/0               0/0              0/0                 28            40  1/10
        5               0/0               0/0              0/0                 30            40  1/10
        6               0/0               0/0              0/0                 32            40  1/10
        7               0/0               0/0              0/0                 34            40  1/10

    Class-map: WRED4_5 (match-all)
      0 packets, 0 bytes
      5 minute offered rate 0000 bps, drop rate 0000 bps
      Match: ip precedence 4  5
      Queueing
      queue limit 64 packets
      (queue depth/total drops/no-buffer drops) 0/0/0
      (pkts output/bytes output) 0/0
      bandwidth 30% (463 kbps)
        Exp-weight-constant: 9 (1/512)
        Mean queue depth: 0 packets
        class       Transmitted         Random drop      Tail drop          Minimum        Maximum     Mark
                pkts/bytes            pkts/bytes       pkts/bytes          thresh         thresh     prob

        0               0/0               0/0              0/0                 20            40  1/10
        1               0/0               0/0              0/0                 22            40  1/10
        2               0/0               0/0              0/0                 24            40  1/10
        3               0/0               0/0              0/0                 26            40  1/10
        4               0/0               0/0              0/0                 31            40  1/10
        5               0/0               0/0              0/0                 33            40  1/10
        6               0/0               0/0              0/0                 32            40  1/10
        7               0/0               0/0              0/0                 34            40  1/10

    Class-map: class-default (match-any)
      19 packets, 1622 bytes
      5 minute offered rate 0000 bps, drop rate 0000 bps
      Match: any

      queue limit 64 packets
      (queue depth/total drops/no-buffer drops) 0/0/0
      (pkts output/bytes output) 19/1622


R1#show policy-map
  Policy Map prec_WRED
    Class WRED0_1
      bandwidth 22 (%)
       packet-based wred, exponential weight 9

      class    min-threshold    max-threshold    mark-probablity
      ----------------------------------------------------------
      0       20               40               1/10
      1       24               40               1/10
      2       -                -                1/10
      3       -                -                1/10
      4       -                -                1/10
      5       -                -                1/10
      6       -                -                1/10
      7       -                -                1/10
    Class WRED2_3
      bandwidth 27 (%)
       packet-based wred, exponential weight 9

      class    min-threshold    max-threshold    mark-probablity
      ----------------------------------------------------------
      0       -                -                1/10
      1       -                -                1/10
      2       26               40               1/10
      3       29               40               1/10
      4       -                -                1/10
      5       -                -                1/10
      6       -                -                1/10
      7       -                -                1/10
    Class WRED4_5
      bandwidth 30 (%)
       packet-based wred, exponential weight 9

      class    min-threshold    max-threshold    mark-probablity
      ----------------------------------------------------------
      0       -                -                1/10
      1       -                -                1/10
      2       -                -                1/10
      3       -                -                1/10
      4       31               40               1/10
      5       33               40               1/10
      6       -                -                1/10
      7       -                -                1/10

(In the next section we are going to configure DSCP)





Tuesday, October 19, 2021

What is the queue? How do software and hardware queues work? Congestion management using Queuing.

Routers use a queue to store traffic until it can be processed or serialized. switches and router interfaces have ingress (inbound) queues and egress (outbound) queues. An ingress (inbound) queue stores packets until the switch or router CPU can forward the data to the appropriate interface.




Cisco routers can be configured to perform well queuing for packets that are waiting to exit an interface. Queues are buffers in devices that hold data to be processed. Queues provide bandwidth reservation and prioritization of traffic as it enters or leaves a network device. If the queues are not emptied, they overflow and drop traffic.

We have two types of queues and fancy queueing QoS tools like CBWFQ  & LLQ.

Hardware queue 

Software queue 

Hardware queues provide the following features:

  • When an interface finishes sending a packet, the next packet from the hardware queue can be encoded and sent out the interface, without ensuring a software interrupt to the CPU—ensuring full use of interface bandwidth.
  • Always use FIFO logic first in first out.
  • Cannot be affected by IOS queuing tools.
  • IOS automatically shrinks the length of the hardware queue to a smaller length than the default when a queuing tool is present.
  • Short hardware queue length means packets are more likely to be in the controllable software queues, giving the software queuing more control of the traffic leaving the interface.
  • The only function of a hardware queue that can be manipulated is the length of the queue.

Congestion management using Queuing

Congestion can occur at any point in the network where there are points of speed mismatches or aggregation, Speed mismatches are the most typical cause of congestion. when the packets travel from LAN to WAN. Generally, a full hardware queue indicates interface congestion and software queuing is used to manage it. The software queuing system can be selected and configured depending on the platform and Cisco IOS version. Queuing manages congestion to provide bandwidth and delay guarantees.



Creation of queues. Assignment of packets to those queues based on the classification of the packets, and scheduling of the packets in a queue for transmission. Allow us to control congestion by determining the order in which packets are sent out an interface based on priorities assigned to those packets. 

INSTAGRAM FEED

@soratemplates