Lecture 01 · Introduction

المحاضرة 01 · مقدمة

Latency lower bound and the four packet delays

الحد الأدنى لزمن الانتقال (latency) وتأخيرات الحزمة الأربعة

Slides 51–55 الشرائح 51–55 P1 MUST

One division turns a distance into the fastest any network could ever answer. Then four named delays explain why real networks sit about three times above that floor.

قسمة واحدة تحوّل المسافة إلى أسرع زمن يمكن لأي شبكة أن تجيب فيه. ثم تشرح أربعة تأخيرات مُسمّاة لماذا تقع الشبكات الحقيقية فوق هذا الحد بنحو ثلاثة أضعاف.

Latency is transit time, paid twice

زمن الانتقال هو زمن العبور، ويُدفع مرتين

Latency is the time data spends in transit between two points (slide 51). The common practice today is to put the server in the cloud, so every request crosses the network to reach it, and the answer crosses back.

Latency هو الزمن الذي تقضيه البيانات في الطريق بين نقطتين (الشريحة 51). والممارسة الشائعة اليوم هي وضع الخادم في cloud، فكل طلب يعبر الشبكة ليصل إليه، والجواب يعبرها راجعاً.

Total latency = Latencyclient→server + Latencyserver→client

The client always starts the exchange, so a request and its response pay latency in both directions. The two one-way figures are usually close, but they do not have to be equal, because Internet routes are not always symmetric.

العميل (client) هو من يبدأ التبادل دائماً، لذلك يدفع الطلب وجوابه latency في الاتجاهين. والقيمتان في الاتجاه الواحد متقاربتان عادة، لكن لا يلزم أن تتساويا، لأن مسارات الإنترنت ليست متماثلة دائماً.

The time the server spends working is not latency. That is processing time, and page 09 adds it to the two latencies to get the response time.

الزمن الذي يقضيه الخادم في العمل ليس latency. هذا هو processing time، وفي الصفحة 09 نضيفه إلى زمني الانتقال لنحصل على response time.

The physical lower bound

الحد الأدنى الفيزيائي

Slide 52 gives the one formula you must own:

الشريحة 52 تعطي المعادلة الوحيدة التي يجب أن تتقنها:

LatencyLB = geodesic distancespeed of light ,   c ≈ 300,000 km/s
RTTLB = 2 × geodesic distancec

It is a lower bound because every simplification can only make the real number bigger: nothing carries information faster than light in vacuum, no cable is shorter than the shortest path over the Earth, and the formula ignores every other delay. No provider, protocol or hardware upgrade can beat it. The only way to lower it is to shorten the distance.

هو حد أدنى (lower bound) لأن كل تبسيط فيه لا يمكن إلا أن يجعل الرقم الحقيقي أكبر: لا شيء ينقل المعلومات أسرع من الضوء في الفراغ، ولا يوجد كابل أقصر من أقصر مسار على سطح الأرض، والمعادلة تتجاهل كل التأخيرات الأخرى. لا يستطيع أي مزوّد أو بروتوكول أو ترقية عتاد أن يتجاوزه. الطريقة الوحيدة لخفضه هي تقصير المسافة.

Memorize this احفظ هذا

Every 1,000 km costs at least 3.33 ms one way (6.67 ms round trip) in vacuum. In fiber it is about 5 ms per 1,000 km one way.

كل 1,000 km تكلّف 3.33 ms على الأقل في الاتجاه الواحد (6.67 ms ذهاباً وإياباً) في الفراغ. وفي الألياف الضوئية (fiber) تكون نحو 5 ms لكل 1,000 km في الاتجاه الواحد.

Sanity anchor from the slides: 3,000 km ÷ 300,000 km/s = 0.01 s = 10 ms one way.

نقطة تحقّق من الشرائح: 3,000 km ÷ 300,000 km/s = 0.01 s = 10 ms في الاتجاه الواحد.

Which distance: geodesic, not planar

أي مسافة: geodesic لا planar

The distance in the formula is the geodesic distance: the shortest path between two points along the curved surface of the Earth (a great-circle arc on a sphere). Slide 53 shows London to Singapore: the straight orange line on the flat map is the planar distance, and the blue curve bending north is the geodesic.

المسافة في المعادلة هي مسافة geodesic: أقصر مسار بين نقطتين على السطح المنحني للأرض (قوس دائرة عظمى، great-circle، على الكرة). الشريحة 53 تُظهر لندن إلى سنغافورة: الخط البرتقالي المستقيم على الخريطة المسطحة هو مسافة planar، والمنحنى الأزرق المتجه شمالاً هو geodesic.

The curve only looks longer because the map flattens a sphere. On the real Earth the geodesic is shorter, and signals travel over the real Earth, so latency always uses the geodesic.

المنحنى يبدو أطول فقط لأن الخريطة تُسطّح الكرة. على الأرض الحقيقية يكون geodesic أقصر، والإشارات تسافر فوق الأرض الحقيقية، لذلك يستخدم حساب latency دائماً مسافة geodesic.

ONE EXCHANGE PAYS THE DISTANCE TWICE Client Dammam Server Frankfurt region request: 4,390 km ÷ c = 14.6 ms response: 4,390 km ÷ c = 14.6 ms RTT lower bound = 2 × 14.6 = 29.3 ms
The bound for a round trip is twice the one-way bound. Any measured RTT has to be compared with this doubled number.حد رحلة الذهاب والإياب ضعف الحد في الاتجاه الواحد. وأي RTT مقاس يجب أن يُقارن بهذا الرقم المضاعف.

Real glass is slower than vacuum

الزجاج الحقيقي أبطأ من الفراغ

The c in the bound is light in vacuum. Real links carry light through glass fiber with a refractive index of about 1.5, so the signal moves at about c / 1.5 ≈ 200,000 km/s, two thirds of c. Even a perfect fiber laid exactly along the geodesic needs 1.5× the bound.

قيمة c في الحد هي سرعة الضوء في الفراغ. أما الروابط الحقيقية فتنقل الضوء عبر ألياف زجاجية معامل انكسارها نحو 1.5، فتتحرك الإشارة بسرعة c / 1.5 ≈ 200,000 km/s تقريباً، أي ثلثي c. حتى الليف المثالي الممدود تماماً على مسار geodesic يحتاج 1.5× من الحد.

Physical bound (vacuum)

الحد الفيزيائي (الفراغ)

t = d / 300,000 km/s

3.33 ms per 1,000 km one way. The absolute floor. Use this when a question says "lower bound" or "speed of light".

3.33 ms لكل 1,000 km في الاتجاه الواحد. هذا هو الحد المطلق. استخدمه حين يقول السؤال "lower bound" أو "speed of light".

Fiber floor (2/3 c)

حد الألياف (2/3 c)

t = d / 200,000 km/s

5 ms per 1,000 km one way. The realistic best case for a cabled path. Use only when the question gives the fiber speed.

5 ms لكل 1,000 km في الاتجاه الواحد. أفضل حالة واقعية لمسار بالكابلات. لا تستخدمه إلا إذا أعطاك السؤال سرعة الألياف.

Bound against measurement: Dammam to three AWS regions

الحد مقابل القياس: من الدمام إلى ثلاث مناطق في AWS

Slide 54 puts the client in Dammam and the server in Frankfurt (eu-central-1), Tokyo (ap-northeast-1) and Oregon (us-west-2), then measures the RTT with aws-latency-test.com. The rule: compare an RTT with twice the one-way bound.

الشريحة 54 تضع العميل في الدمام والخادم في فرانكفورت (eu-central-1) وطوكيو (ap-northeast-1) وأوريغون (us-west-2)، ثم تقيس RTT عبر aws-latency-test.com. القاعدة: قارن RTT مع ضعف الحد في الاتجاه الواحد.

Worked مثال محلول
Dammam to Frankfurt, geodesic about 4,390 km

  one-way bound   4,390 / 300,000  = 0.01463 s  = 14.6 ms
  RTT bound       2 x 14.6         = 29.3 ms
  fiber RTT       2 x 4,390 / 200,000 = 0.0439 s = 43.9 ms
  measured RTT    100 ms

  measured / RTT bound   = 100 / 29.3  = 3.4x
  measured / fiber floor = 100 / 43.9  = 2.3x

Physics forbids anything below 29.3 ms. The other roughly 56 ms above the fiber floor comes from cable detours, routers and queues.

الفيزياء تمنع أي قيمة أقل من 29.3 ms. والـ 56 ms تقريباً الزائدة فوق حد الألياف تأتي من التفافات الكابلات والموجّهات (routers) والطوابير (queues).

RegionالمنطقةGeodesicمسافة geodesicBound one way / RTTالحد: اتجاه واحد / RTTFiber RTTRTT في الأليافMeasured RTTRTT المقاسMeasured ÷ RTT boundالمقاس ÷ حد RTT
Frankfurtفرانكفورت≈ 4,390 km14.6 / 29.3 ms43.9 ms100 ms≈ 3.4×
Tokyoطوكيو≈ 8,300 km27.7 / 55.3 ms83.0 ms163 ms≈ 2.9×
Oregonأوريغون≈ 11,900 km39.7 / 79.4 ms119 ms243 ms≈ 3.1×

يلخّص الجدول المناطق الثلاث. فرانكفورت: ≈ 4,390 km، والحد 14.6 / 29.3 ms، والألياف 43.9 ms، والمقاس 100 ms، والنسبة ≈ 3.4×. طوكيو: ≈ 8,300 km، والحد 27.7 / 55.3 ms، والألياف 83.0 ms، والمقاس 163 ms، والنسبة ≈ 2.9×. أوريغون: ≈ 11,900 km، والحد 39.7 / 79.4 ms، والألياف 119 ms، والمقاس 243 ms، والنسبة ≈ 3.1×.

The ratio is about 3× for all three regions, at very different distances. A stable ratio means the extra cost is systematic: 1.5× from glass, plus cable routes that follow coastlines and seabeds instead of the geodesic, plus processing and queueing at every router.

النسبة نحو 3× في المناطق الثلاث رغم اختلاف المسافات كثيراً. وثبات النسبة يعني أن التكلفة الإضافية منهجية: 1.5× من الزجاج، ثم مسارات كابلات تتبع السواحل وقيعان البحار بدلاً من geodesic، ثم المعالجة والانتظار في كل موجّه.

ROUND TRIP FROM DAMMAM, IN MS Frankfurt Tokyo Oregon 29.3 bound 43.9 fiber 100 measured 55.3 bound 83.0 fiber 163 measured 79.4 bound 119 fiber 243 measured
Solid bar: vacuum RTT bound. Middle bar: perfect fiber along the geodesic. Bottom bar: what aws-latency-test.com measured. The measurement is about three times the bound every time.الشريط المصمت: حد RTT في الفراغ. الشريط الأوسط: ليف مثالي على مسار geodesic. الشريط السفلي: ما قاسه aws-latency-test.com. القياس نحو ثلاثة أضعاف الحد في كل مرة.
Slide 54 errata تصحيح الشريحة 54

The slide title says "planar distance", but slide 52 says to use the geodesic and the Frankfurt (14.7 ms) and Tokyo (27.7 ms) figures match geodesic distances. The slide's Oregon value of 37 ms implies about 11,100 km, while the great-circle distance is about 11,900 km, giving 39.7 ms. If the exam quotes 37 ms, use it; if you compute from a distance, use geodesic. Also, the 37 ms is a one-way bound, while 243 ms is a measured round trip.

عنوان الشريحة يقول "planar distance"، لكن الشريحة 52 تقول استخدم geodesic، وقيمتا فرانكفورت (14.7 ms) وطوكيو (27.7 ms) تطابقان مسافات geodesic. وقيمة أوريغون في الشريحة 37 ms تعني نحو 11,100 km، بينما مسافة الدائرة العظمى نحو 11,900 km، أي 39.7 ms. إذا ذكر الامتحان 37 ms فاستخدمها، وإذا حسبت من مسافة فاستخدم geodesic. وانتبه: 37 ms هي حد في اتجاه واحد، بينما 243 ms هي رحلة ذهاب وإياب مقاسة.

Latency over the Internet: up to 100× the bound

زمن الانتقال عبر الإنترنت: حتى 100× من الحد

Slide 55 says Internet latencies can be as large as 100× LatencyLB, with the example of a 15 ms theoretical latency becoming 1,500 ms. Measurements support this for whole page fetches: Singla et al. found that fetching the HTML of popular pages took 34× the speed-of-light RTT at the median and 169× at the 90th percentile. Those fetches stack DNS lookups, the TCP handshake and slow start on top of the per-hop delays.

تقول الشريحة 55 إن زمن الانتقال عبر الإنترنت قد يصل إلى 100× من LatencyLB، ومثالها أن 15 ms نظرية قد تصبح 1,500 ms. والقياسات تدعم هذا لجلب الصفحات كاملة: وجد Singla et al. أن جلب HTML لصفحات مشهورة استغرق 34× من RTT بسرعة الضوء عند الوسيط، و169× عند المئين 90. فهذه العمليات تُراكم استعلام DNS ومصافحة TCP وslow start فوق تأخيرات كل قفزة.

The four packet delays

تأخيرات الحزمة الأربعة

Propagation, the physical distance, is only one element. Every packet pays four delays at every node it crosses (Kurose and Ross, section 1.4):

التأخير الناتج عن المسافة الفيزيائية (propagation) عنصر واحد فقط. كل حزمة تدفع أربعة تأخيرات عند كل عقدة تعبرها (Kurose and Ross، القسم 1.4):

dnodal = dproc + dqueue + dtrans + dprop
  1. Processing delay. Inside switches, routers and hosts: checking headers and bit errors, looking up where to forward. Driven by the device, usually microseconds.

    Processing delay. داخل المبدّلات والموجّهات والأجهزة: فحص الترويسات وأخطاء البتات، والبحث عن وجهة التمرير. يعتمد على الجهاز، وعادة يُقاس بالميكروثانية.

  2. Queueing delay. Waiting in router and server buffers behind packets that arrived first. Driven by congestion, from zero at night to hundreds of milliseconds at peak.

    Queueing delay. الانتظار في ذاكرات الموجّهات والخوادم خلف حزم وصلت قبلك. يعتمد على الازدحام (congestion)، من صفر ليلاً إلى مئات الميلي ثانية في الذروة.

  3. Transmission delay = L / R. At the network interface card, pushing all L bits of the packet onto a link of rate R bits per second. Driven by packet size and bandwidth. Nothing to do with distance.

    Transmission delay = L / R. عند بطاقة الشبكة (NIC)، دفع كل بتات الحزمة L على رابط معدّله R بت في الثانية. يعتمد على حجم الحزمة وbandwidth، ولا علاقة له بالمسافة.

  4. Propagation delay = d / s. Along the physical channel (fiber, copper, radio): link length d divided by signal speed s, about 200,000 km/s in fiber. Driven by distance. Nothing to do with bandwidth.

    Propagation delay = d / s. على القناة الفيزيائية (ألياف، نحاس، راديو): طول الرابط d مقسوماً على سرعة الإشارة s، نحو 200,000 km/s في الألياف. يعتمد على المسافة، ولا علاقة له بـ bandwidth.

Worked مثال محلول
one 1,500-byte packet, Dammam to Frankfurt fiber (4,390 km)

  L = 1,500 x 8 = 12,000 bits

  transmission at 1 Gbps    12,000 / 10^9   = 12 us
  transmission at 10 Mbps   12,000 / 10^7   = 1.2 ms
  propagation (either link) 4,390 / 200,000 = 0.02195 s = 22 ms

  100x less bandwidth: transmission grows 100x,
  propagation does not move by a single microsecond.

Convert bytes to bits first (multiply by 8). That is the most common slip in L / R.

حوّل البايتات إلى بتات أولاً (اضرب في 8). هذا هو الخطأ الأكثر شيوعاً في L / R.

DelayالتأخيرWhereأينDriven byيعتمد علىShrinks whenيقلّ عندما
Processingالمعالجة (processing)switches, routers, devicesالمبدّلات والموجّهات والأجهزةdevice speedسرعة الجهازfaster hardware, fewer hopsعتاد أسرع، قفزات أقل
Queueingالانتظار (queueing)routers and serversالموجّهات والخوادمcongestionالازدحامless traffic, fewer hopsحركة أقل، قفزات أقل
Transmissionالإرسال (transmission)network interface cardبطاقة واجهة الشبكة (NIC)L / R, bandwidthL / R، bandwidthmore bandwidth, smaller packetsbandwidth أكبر، حزم أصغر
Propagationالانتشار (propagation)physical channelالقناة الفيزيائيةd / s, distanced / s، المسافةonly when the endpoints move closerفقط عندما تقترب النهايتان من بعضهما

الجدول يلخّص التأخيرات الأربعة: processing في المبدّلات والموجّهات ويقلّ بعتاد أسرع وقفزات أقل. وqueueing في الموجّهات والخوادم ويعتمد على الازدحام ويقلّ بحركة أقل. وtransmission عند بطاقة الشبكة ويساوي L / R ويقلّ بزيادة bandwidth. وpropagation على القناة الفيزيائية ويساوي d / s ولا يقلّ إلا إذا اقتربت النهايتان من بعضهما.

Memory hook مفتاح للتذكر

"Bandwidth widens the pipe, distance is the length of the road." A bigger internet plan pushes bits on faster (transmission), but the road to Frankfurt is just as long (propagation). This is the physical argument for edge computing: the cloud can buy bandwidth and faster routers, but it cannot shorten d.

"Bandwidth widens the pipe, distance is the length of the road." أي: bandwidth يوسّع الأنبوب، والمسافة هي طول الطريق. الباقة الأسرع تدفع البتات أسرع (transmission)، لكن الطريق إلى فرانكفورت بالطول نفسه (propagation). هذه هي الحجة الفيزيائية لـ edge computing: يستطيع cloud شراء bandwidth وموجّهات أسرع، لكنه لا يستطيع تقصير d.

Practice computation

تمرين حسابي

Do it with a pen before reading the answer: Dammam to London is about 5,020 km along the geodesic. Give the one-way bound, the RTT bound and the fiber RTT floor. If the measured RTT is 120 ms, what is the ratio to the RTT bound?

احسبها بالقلم قبل قراءة الجواب: المسافة من الدمام إلى لندن نحو 5,020 km على geodesic. أعطِ الحد في اتجاه واحد، وحد RTT، وحد الألياف لـ RTT. وإذا كان RTT المقاس 120 ms، فما النسبة إلى حد RTT؟

Worked مثال محلول
one-way bound   5,020 / 300,000         = 0.01673 s = 16.7 ms
RTT bound       2 x 16.7                 = 33.5 ms
fiber one way   5,020 / 200,000          = 25.1 ms
fiber RTT       2 x 25.1                 = 50.2 ms
ratio           120 / 33.5               = 3.6x

Check with the shortcut: 5.02 thousand km × 3.33 ms ≈ 16.7 ms. Matches.

تحقّق بالاختصار: 5.02 ألف كيلومتر × 3.33 ms ≈ 16.7 ms. متطابق.

Exam traps فخاخ الامتحان

Forgetting to double for RTT. d / c is one way. An RTT, or any request-response question, needs 2d / c. Write "one way" or "RTT" next to every number.

نسيان المضاعفة لـ RTT. d / c للاتجاه الواحد فقط. أما RTT أو أي سؤال طلب وجواب فيحتاج 2d / c. اكتب "اتجاه واحد" أو "RTT" بجانب كل رقم.

Using fiber speed when the question asks for the physical bound. "Lower bound" means c = 300,000 km/s. 200,000 km/s gives a bigger number, which is the fiber floor, not the bound.

استخدام سرعة الألياف حين يسأل السؤال عن الحد الفيزيائي. "Lower bound" يعني c = 300,000 km/s. أما 200,000 km/s فتعطي رقماً أكبر، وهو حد الألياف وليس الحد الأدنى.

Mixing transmission and propagation. Transmission = size / bandwidth (L / R). Propagation = distance / speed (d / s). A bandwidth upgrade never changes propagation.

الخلط بين transmission وpropagation. Transmission = الحجم ÷ bandwidth (L / R). وPropagation = المسافة ÷ السرعة (d / s). ترقية bandwidth لا تغيّر propagation أبداً.

Only moving closer removes propagation delay. Not a faster server, not 5G, not a better ISP.

الاقتراب وحده يزيل propagation delay. لا الخادم الأسرع، ولا 5G، ولا مزوّد إنترنت أفضل.

Everything on one card

كل شيء في بطاقة واحدة

Latency cheat card

بطاقة مراجعة زمن الانتقال

Check yourself

اختبر نفسك

A server is 6,000 km away along the geodesic. What is the round-trip latency lower bound?

خادم على بُعد 6,000 km على geodesic. ما الحد الأدنى لزمن الذهاب والإياب؟

One way: 6,000 ÷ 300,000 = 0.02 s = 20 ms. Round trip doubles it: 40 ms. Option A forgets to double. Option C is the round trip in fiber (2 × 6,000 ÷ 200,000), which is a floor for cables, not the physical bound. Option D is fiber one way.

في اتجاه واحد: 6,000 ÷ 300,000 = 0.02 s = 20 ms. والذهاب والإياب يضاعفه: 40 ms. الخيار A ينسى المضاعفة. والخيار C هو RTT في الألياف (2 × 6,000 ÷ 200,000)، وهو حد للكابلات وليس الحد الفيزيائي. والخيار D هو الألياف في اتجاه واحد.

The measured Dammam to Frankfurt RTT is 100 ms against a 29.3 ms RTT bound. What best explains the gap of about 3×?

RTT المقاس من الدمام إلى فرانكفورت 100 ms مقابل حد RTT قدره 29.3 ms. ما أفضل تفسير للفجوة البالغة نحو 3×؟

Glass alone costs 1.5× (light at about 2/3 c), cables do not follow the geodesic, and every router adds processing and queueing. 29.3 ms is already the round-trip figure, light does not slow with distance, and no cable can be shorter than the geodesic, so A, B and D are false.

الزجاج وحده يكلّف 1.5× (الضوء بنحو 2/3 c)، والكابلات لا تتبع geodesic، وكل موجّه يضيف processing وqueueing. و29.3 ms هي أصلاً قيمة الذهاب والإياب، والضوء لا يتباطأ مع المسافة، ولا يوجد كابل أقصر من geodesic، لذا فالخيارات A وB وD خاطئة.

What is the transmission delay of a 1,500-byte packet on a 10 Mbps link?

ما قيمة transmission delay لحزمة حجمها 1,500 بايت على رابط 10 Mbps؟

L / R = (1,500 × 8) bits ÷ 107 bits/s = 12,000 ÷ 10,000,000 = 1.2 ms. Option B forgets to convert bytes to bits. Option C is the 1 Gbps answer. Option D confuses transmission with propagation: link length only affects d / s.

L / R = (1,500 × 8) ÷ 107 = 12,000 ÷ 10,000,000 = 1.2 ms. الخيار B ينسى تحويل البايت إلى بت. والخيار C هو جواب 1 Gbps. والخيار D يخلط transmission مع propagation: طول الرابط يؤثر في d / s فقط.

A company upgrades its Dammam to Oregon link from 100 Mbps to 10 Gbps on the same cable route. Which delay is unchanged?

شركة رقّت رابطها من الدمام إلى أوريغون من 100 Mbps إلى 10 Gbps على مسار الكابل نفسه. أي تأخير لا يتغيّر؟

Propagation is d / s: the same distance at the same signal speed. Only moving the endpoints closer changes it. Transmission (L / R) drops 100×. Queueing may ease if congestion drops, but it does not vanish by rule.

Propagation يساوي d / s: المسافة نفسها بسرعة الإشارة نفسها. لا يغيّره إلا تقريب النهايتين. أما transmission (L / R) فينخفض 100×. وqueueing قد يخف إذا قلّ الازدحام، لكنه لا يختفي بقاعدة.

Which distance should be used to compute the latency lower bound between two cities?

أي مسافة يجب استخدامها لحساب الحد الأدنى لزمن الانتقال بين مدينتين؟

Slide 52: the physical distance is the geodesic distance along the surface of the Earth. It is the shortest possible surface path, which is what makes the result a true lower bound. Cable length gives a larger, real-world figure, not the bound.

الشريحة 52: المسافة الفيزيائية هي مسافة geodesic على سطح الأرض. إنها أقصر مسار سطحي ممكن، وهذا ما يجعل النتيجة حداً أدنى حقيقياً. أما طول الكابل فيعطي رقماً واقعياً أكبر، وليس الحد.