12

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.

Carlos
  • 5,655
  • 5
  • 41
  • 78
MhdSyrwan
  • 1,441
  • 3
  • 18
  • 25

2 Answers2

15
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
Mike Pennington
  • 38,579
  • 16
  • 126
  • 167
  • but i don't have these parameters – MhdSyrwan Dec 30 '11 at 18:59
  • 2
    @MhdSyrwan, which parameters don't you have? Queueing delay? Processing delay is in the same category as processing delay. If you don't have a parameter, make the value in the equation zero – Mike Pennington Dec 30 '11 at 19:01
  • where could i put the given latency ? is it the link media delay ? – MhdSyrwan Dec 30 '11 at 19:25
  • Why do we simply add Node Processing Delay to the total time? Say the file is very large, or even a stream of data, we cannot assume any buffer in the path, the sender can only send at the rate of min(Link Data Rate, Node Processing Rate). – Dagang Jun 25 '16 at 05:38
  • @MikePennington is there any research paper related to your answer? I need to add reference of this formula in my work. Kindly help in this regards. – Salman Lone Feb 02 '17 at 06:47
  • @MhdSyrwan you found this answer helpful. Can you help me in referencing this formula? – Salman Lone Feb 02 '17 at 07:59
  • @SalmanLone I derived the formula from the theory I learned in college and my experience working with these things. – Mike Pennington Mar 17 '17 at 21:00
  • @MikePennington Thank you for the reply. Your formula is helping me in my work. – Salman Lone Mar 18 '17 at 11:43
6

Quite roughly, the formula is:

LATENCY + SIZE / THROUGHPUT<br>
In your example:<br>
LATENCY = 40ms = 0.04<br>
SIZE = 1000*2<br>
THGOUGHPUT = 2Mbps = 250,000 Bytes/second<br>

Bottom line:

0.04 + 2000 / 250000 = 0.048 = 48ms<br>

Notice that I converted all units to bytes and seconds, so calculations are meaningful.
This is more accurate for large packets. For small packets, real numbers are larger.

Prafulla Kumar Sahu
  • 7,813
  • 7
  • 46
  • 85
ugoren
  • 15,127
  • 2
  • 28
  • 59
  • so you used the bandwidth as a throughput ? – MhdSyrwan Dec 30 '11 at 20:12
  • 1
    @MhdSyrwan, use this answer at your own risk. It does not account for frame serialization time. – Mike Pennington Dec 30 '11 at 20:16
  • but i don't have the link data rate ,how to calculate it ? – MhdSyrwan Dec 30 '11 at 22:22
  • 1
    My answer is indeed quite simplistic, and doesn't take all factors in account. It should be reasonably accurate for large frames, but would be too optimistic for small ones. – ugoren Dec 31 '11 at 10:17
  • here you are taking the 2 packets together not one by one ,why ? – MhdSyrwan Dec 31 '11 at 14:36
  • @MhdSyrwan, link data rate is bandwidth. I think you should find a good book on the subject (your course book??), because you don't seem to understand the concepts behind what you're asking about. You will never be able to fly on your own if you need help flapping your wings. – Mike Pennington Dec 31 '11 at 14:42
  • @ugoren, Bytes != bits. Link data speed is specified in bits per second. – Mike Pennington Dec 31 '11 at 14:52
  • 1
    @MikePennington, I know bytes!=bits. That's why 2Mbps=250,000 Bytes/second. You have to bring everything to common units before you calculate, so I chose to use bytes and seconds. – ugoren Dec 31 '11 at 17:26
  • Quick question, what is SIZE in your example ? is this packetsize ? – user2065929 Apr 16 '13 at 15:15