Search code examples
networkingcommunicationlatencyswitchingpackets

How to calculate packet time from latency and bandwidth


I have a link between a host and a switch.

The link has a bandwidth & a latency. How to calculate the time of 2 packets(with size 1KB) to be transferred from Host A to Switch 1?

Here's the diagram(I am talking about the first link)

Latency & Bandwidth

Note: I just want to calculate it manually for these values, I want to know the principles/laws of calculating these problems.


Solution

  • Propagation time = (Frame Serialization Time) 
                      + (Link Media Delay) 
                      + (Queueing Delay) 
                      + (Node Processing Delay - if known)
    

    Formulas:

    • Frame Serialization Time = S/R
    • Link Media Delay = D/p
    • Queueing Delay = Q / R
    • Node processing delay is normally specified or measured

    Variable decoder:

    • R: link data rate (bits/second)
    • S: Packet size (bits)
    • D: Link distance (meters)
    • P Processing Delay (seconds)
    • p: medium propagation speed (meters/second)
      • speed in copper is 210*10**6
      • speed in fiber is 300*10**6
    • Q: Queue depth (bits); note: if the link is not congested, there is no Queue depth

    Applying to your question:

    I will only calculate information for the link between Host A and Switch 1:

    Frame Serialization Time =  Packet_size_bits / Link_data_rate_bps
                             = 2*1024*8 / (2*10**6)
                             = 0.00819 [seconds]
    Link Media Delay         = 0.04 seconds [from diagram: 40ms]
    Queueing Delay           = 0.0 [assume no congestion]
    Node Processing Delay    = 0.0 [Host A had nothing specified for delay]
    -----------------------------------------------------------------------
                   Total     = 0.00819 + 0.04 + 0.0 + 0.0
                             = 0.04819 seconds
                             = 48.2 milliseconds for two 1KB packets to go from 
                                                 Host A to Switch 1