Tuesday, October 22, 2013

Fast path and Slow path

Long back I debugged a problem where a video client was receiving some of the packets of a video stream out of order. During debugging, we found that some of the packets of the video stream were taking Fast Path while some of them were taking Slow Path.

So what exactly is Fast Path and Slow Path?

Before I get into that, let me tell you a little bit about router architecture. Routers usually have a general purpose processor (similar to CPU used in PCs) which is used for handling the control plane requirements like configuration of the device, networking protocols and packets destined to the router. In early routers, the same general purpose processor was used for forwarding the data packets as well. So as you can imagine the data forwarding was really slow.

Later as technology evolved, our routers needed to forward data packets with higher speed and a general purpose processor could not do this. So it was decided to move data forwarding part to a special purpose processor, usually known as Network Processor. Network Processor's sole responsibility is to forward the data packets. So current breed of routers use a general purpose processor for control plane requirements and a Network Processor to forward data packets at wire speed.

Now when a packet is forwarded at wire speed with minimal latency, the packet is said to be taking Fast Path. Why is this called Fast Path? Because a data packet is forwarded at the fastest speed. So who is forwarding this data traffic? What did you say? Network Processor. Yeah! You got this right. Now with this background, I am sure you can figure out which path is Slow Path. If you said, that when the packet is forwarded by the general purpose processor, I would say, Congratulations, you got this also right.

Someone might ask if Network Processor is suppose to forward data traffic when does general purpose processor forward the data traffic. A good question. It can happen in the following cases:
  1. When ARP needs to be resolved for a gateway, Network Processor sends all the data packets to the control plane. Once ARP is resolved, control plane forwards these packets. Subsequent packets will be forwarded by Network Processor.
  2. There could be an issue because of which Network Processor might not have enough information to forward a packet. In such a case, Network Processor sends these packets to control plane and control plane may forward it.
So the issue I was debugging was seen because of the 2nd case.

Please let me know if you have come across an issue where data traffic was taking Slow Path.

3 comments:

  1. There could be one more design case where slow path can be handy - like IP options processing or Reassembly , you can divert all these packets to slow path and pump back them once the processing is done....This keeps fast path agile and fast :)

    ReplyDelete
    Replies
    1. Yes. You are right about IP options. But reassembly would usually be done at the destination. If the outgoing interface MTU is smaller than the packet size, for fragmenting the packet, Network Processor will send a packet to control plane and then those fragmented packets will take Slow Path on this router.

      Delete