From 04c94395abecc7cf581fb237cc51851d3b69c939 Mon Sep 17 00:00:00 2001 From: Stephen C Phillips <steve@scphillips.com> Date: Wed, 23 May 2018 14:05:43 +0100 Subject: [PATCH] Improves formatting --- docs/total-service-request-delay.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/total-service-request-delay.md b/docs/total-service-request-delay.md index bb65512..3237197 100644 --- a/docs/total-service-request-delay.md +++ b/docs/total-service-request-delay.md @@ -2,7 +2,9 @@ The Round Trip Time (RTT) of a network is the time taken from sending a packet to receiving the acknowlegement. We are also interested in factoring in the size of the data being sent over the network and the delay caused by the service processing the request. +```math total_delay = forward_network_delay + service_delay + reverse_network_delay +``` ## Network delay @@ -12,7 +14,9 @@ network_delay = time delay from first byte leaving source to final byte arriving If we ignore the OSI L6 protocol (e.g. HTTP, FTP, Tsunami) then we are modelling a chunk of data moving along a wire. The network delay is then: +```math network_delay = latency + (time difference from start of the data to the end of the data) +``` ### Latency @@ -22,14 +26,14 @@ latency = distance / speed For optical fibre (or even an eletric wire), the speed naively would be the speed of light. In fact, the speed is slower than this (in optical fibre this is because of the internal refraction that occurs, which is different for different wavelengths). According to http://www.m2optics.com/blog/bid/70587/Calculating-Optical-Fiber-Latency the delay (1/speed) is approximately 5 microseconds / km ->>> +```math if distance is in m delay is in s/m latency is in s then latency = distance * 5 / 1E9 ->>> +``` (this matches MJB's "propogation_delay" formula) @@ -39,32 +43,32 @@ Normally we would just measure the latency of a link. Most real-life connections The time difference from start of the data to the end of the data (or "data delay" for want of a better term) is dependent on the bandwidth of the network and the amount of data. ->>> +```math if data_size is in Bytes bandwidth is in Mb/s data_delay is in s then data_delay = data_size * 8 / bandwidth * 1E6 ->>> +``` The data_size naively is the size of the data you want to send over the network (call this the "file_size"). However, the data is split into packets and each packet has a header on it so the amount of data going over the network is actually more than the amount sent. ->>> +```math let packet_size = packet_header_size + packet_payload_size then data_size = (packet_size / packet_payload_size) * file_size or data_size = (packet_size / packet_size - packet_header_size) * file_size ->>> +``` ### Total delay ->>> +```math delay = latency + data_delay = (distance * 5 / 1E9) + {[(packet_size / packet_size - packet_header_size) * file_size] * 8 / bandwidth * 1E6} ->>> +``` ### Effect of Protocol -- GitLab