Majid Al-RaimiMapping tasks and response timeتوزيع المهام وزمن الاستجابة

COE 558Lecture 01المحاضرة 01Part 09الجزء 09

Mapping tasks and response timeتوزيع المهام وزمن الاستجابة

Four ways to place an object-detection pipeline on the continuum, how response time is computed, and why faster servers are not enough.أربع طرق لوضع خط معالجة لاكتشاف الأجسام (object detection) على السلسلة، وكيف يُحسب زمن الاستجابة (response time)، ولماذا لا تكفي الخوادم الأسرع وحدها.

Conceptsالمفاهيم
6
Slidesالشرائح
61-71
Readingمدة القراءة
36 min36 دقيقة
Understoodما فهمته
0/6 conceptsمفاهيم

Why this part mattersلماذا يهمّ هذا الجزء

Every edge versus cloud argument in this course, and every placement choice in your research project, reduces to one question: which layer runs which task, and what does that do to the time the user waits?

The last two parts gave you the layers of the continuum and the four delays that make up latency. This part puts them together. You get a small vocabulary (mapping, processing time, response time), one formula you will reuse in exams and papers, and four reference designs that show the same pipeline paying very different prices depending on where it runs.

كل نقاش بين الحافة والسحابة في هذا المقرر، وكل قرار عن مكان التشغيل في مشروعك البحثي، يعود إلى سؤال واحد: أي طبقة تشغّل أي مهمة، وما أثر ذلك على الوقت الذي ينتظره المستخدم؟

الجزءان السابقان أعطياك طبقات الاستمرارية والتأخيرات الأربعة التي يتكون منها زمن التأخير (latency). هذا الجزء يجمعهما معًا. ستحصل على مفردات قليلة (mapping وprocessing timeوresponse time)، ومعادلة واحدة ستعيد استخدامها في الاختبارات والأوراق البحثية، وأربعة تصاميم مرجعية تُظهر كيف يدفع خط المعالجة نفسه أثمانًا مختلفة جدًا بحسب مكان تشغيله.

By the end you canفي نهاية هذا الجزء ستستطيع

  1. Treat a mapping as a design decision that places each pipeline task on device, edge, fog or cloud.أن تتعامل مع التعيين (mapping) كقرار تصميمي يضع كل مهمة من مهام خط المعالجة على الجهاز أو الحافة أو الضباب أو السحابة.
  2. Compute response time as L1 + PT + L2 and read off how much of it is computation.أن تحسب زمن الاستجابة على أنه L1 + PT + L2 وتستخرج منه نسبة ما يذهب إلى الحوسبة.
  3. Argue with Amdahl's reasoning why a faster server barely helps a distant client, and what does help.أن تبرهن باستدلال Amdahl لماذا لا يفيد الخادم الأسرع العميل البعيد إلا قليلًا، وما الذي يفيد فعلًا.
  4. Weigh the four mappings against each other on latency, privacy, reach, scalability and transfer cost.أن توازن بين التعيينات الأربعة من حيث زمن التأخير والخصوصية ونطاق التغطية وقابلية التوسع وتكلفة نقل البيانات.
  5. Justify why most real systems pair edge with cloud and treat fog as an optional tier.أن تعلل لماذا تجمع معظم الأنظمة الحقيقية بين الحافة والسحابة وتعامل الضباب كطبقة اختيارية.

Picture a phone camera taking a street photo. Three things must happen before the user sees a useful result: the photo is shrunk to the size the model expects (T1, image resize), a model finds the cars and people in it (T2, object detection), and a box is drawn around each one (T3, drawing the bounding box).

تخيّل كاميرا هاتف تلتقط صورة لشارع. قبل أن يرى المستخدم نتيجة مفيدة يجب أن تحدث ثلاثة أشياء: تُصغَّر الصورة إلى الحجم الذي يتوقعه النموذج (T1، تغيير حجم الصورة)، ثم يكتشف نموذج السيارات والأشخاص فيها (T2، اكتشاف الأجسام)، ثم يُرسم مربع حول كل واحد منها (T3، رسم مربع الإحاطة).

Those three ordered steps form a service pipeline. The pipeline says what must happen and in what order. It says nothing about where. The edge-to-cloud continuum offers device, edge, fog and cloud, and each task can land on any of them. Choosing a Layer for every task is called a Mapping, and the rest of this part compares four such choices for the same three tasks.

هذه الخطوات الثلاث المرتبة تشكّل خط معالجة الخدمة (service pipeline). يحدد خط المعالجة ما يجب أن يحدث وبأي ترتيب، لكنه لا يقول شيئًا عن المكان. الاستمرارية من الحافة إلى السحابة (edge-to-cloud continuum) توفر الجهاز والحافة والضباب والسحابة، ويمكن أن تقع كل مهمة على أي منها. اختيار طبقة (layer) لكل مهمة يسمى تعيينًا (mapping)، وبقية هذا الجزء تقارن أربعة اختيارات من هذا النوع للمهام الثلاث نفسها.

The baseline: everything on one cloud serverخط الأساس: كل شيء على خادم سحابي واحد

The simplest mapping puts all three tasks on one Server in a distant Cloud data center. The Client only sends the photo and receives the finished image. Call this Mapping 1; it is the yardstick the other three are measured against.

أبسط تعيين يضع المهام الثلاث كلها على server واحد في مركز بيانات cloud بعيد. العميل (client) يرسل الصورة فقط ويستقبل الصورة النهائية. سنسمي هذا التعيين 1، وهو المقياس الذي تُقارَن به التعيينات الثلاثة الأخرى.

Client
Device

Sends the photo, shows the result

يرسل الصورة ويعرض النتيجة

Latency 1
Server
Cloud layer

T1 resize, then T2 detect, then T3 draw

T1 تغيير الحجم، ثم T2 الكشف، ثم T3 الرسم

Latency 2
Client
Device

Receives the boxed image

يتلقى الصورة مع المربعات المحيطة

Mapping 1: the client sends a photo to a cloud server that runs the whole pipelineالتعيين 1: يرسل العميل صورة إلى خادم سحابي يشغّل خط المعالجة بالكامل

Measuring what the user feelsقياس ما يشعر به المستخدم

To compare mappings you need one number that captures the user's experience. Start a stopwatch when the photo leaves the phone and stop it when the boxed image arrives back. That total is the Response time (RT), and it splits into three stretches: the request travels to the server (Latency 1), the server runs T1, T2 and T3 (the Processing time (PT)), and the result travels back (Latency 2).

لكي تقارن بين التعيينات تحتاج إلى رقم واحد يعبّر عن تجربة المستخدم. شغّل ساعة إيقاف عندما تغادر الصورة الهاتف، وأوقفها عندما تصل الصورة المؤطَّرة بالمربعات. هذا المجموع هو زمن الاستجابة (response time)، وينقسم إلى ثلاثة مقاطع: انتقال الطلب إلى الخادم (Latency 1)، وتشغيل الخادم للمهام T1 وT2 وT3 (زمن المعالجة (processing time))، ثم عودة النتيجة (Latency 2).

RT=L1+PT+L2RT = L_1 + PT + L_2
Response time seen by the clientزمن الاستجابة كما يراه العميل

Neither latency term is a single number from nature. From Part 7 you know each Latency is the sum of Propagation delay, Transmission delay, Queueing delay and Processing delay along every link and router on the path (Kurose and Ross). L1 plus L2 is roughly the round-trip time you would measure with ping, and PT is extra time inserted in the middle.

لا يوجد حدّ من حدود زمن التأخير هو رقم ثابت من الطبيعة. تعرف من الجزء 7 أن كل latency هو مجموع تأخير الانتشار (propagation delay) وتأخير الإرسال (transmission delay) وتأخير الانتظار في الطابور (queueing delay) وتأخير المعالجة (processing delay) على كل وصلة وموجّه في المسار (Kurose and Ross). مجموع L1 وL2 يساوي تقريبًا زمن الذهاب والإياب (round-trip time) الذي تقيسه بأمر ping، وPT وقت إضافي يُدرج في المنتصف.

The examples here treat L1 and L2 as equal only for simplicity. In practice they can differ: the request is often a small upload while the response is a large annotated image, and transmission delay grows with the number of bits pushed onto a link. Every mapping below is just a different way of making these terms bigger or smaller, which is why the formula is the lens for the whole part.

الأمثلة هنا تعامل L1 وL2 على أنهما متساويان للتبسيط فقط. في الواقع قد يختلفان: الطلب غالبًا رفع صغير بينما الاستجابة صورة كبيرة عليها تعليقات، وتأخير الإرسال يزداد مع عدد البتات المدفوعة على الوصلة. كل تعيين في الأقسام التالية هو ببساطة طريقة مختلفة لتكبير هذه الحدود أو تصغيرها، ولهذا فالمعادلة هي العدسة التي ننظر بها إلى الجزء كله.

SimulatorمحاكيMap a pipeline onto the continuumوزّع خط معالجة على السلسلة المتصلة (continuum)
  1. T1Image resizeتصغير الصورةPT 8 ms
  2. T2Object detectionاكتشاف الأجسامPT 40 ms
  3. T3Draw boxesرسم المربعاتPT 8 ms
150 ms
Networkالشبكة40ms
Response timeزمن الاستجابة96ms
Within budgetضمن الميزانية RT ≤ 150 ms
τ
networkالشبكة 40 ms · 42%processingالمعالجة 56 ms · 58%

Formulaالمعادلة

RT = Σ one-way hops + Σ PT

RT = (5 + 15 + 15 + 5) + (8 + 40 + 8) = 96 ms

Client→Edge 5 · Edge→Fog 15 · Fog→Edge 15 · Edge→Client 5

Each hop costs the difference between the one-way latencies of the two layers: Device 0, Edge 5, Fog 20, Cloud 70 ms from the client.تكلفة كل قفزة (hop) هي الفرق بين زمني الانتقال أحادي الاتجاه للطبقتين: الجهاز (Device) 0، والحافة (Edge) 5، والضباب (Fog) 20، والسحابة (Cloud) 70 ms من العميل.

Recall

Write the response time formula for Mapping 1 and say which terms the client cannot shorten by buying faster server hardware.اكتب معادلة زمن الاستجابة للتعيين 1، وبيّن أي الحدود لا يستطيع العميل تقصيرها بشراء عتاد خادم أسرع.

RT = L1 + PT + L2. A faster server only shrinks PT. L1 and L2 are network delays, bounded by distance and the speed of light, so server hardware does not touch them.
RT = L1 + PT + L2. الخادم الأسرع يقلّص PT فقط. أما L1 وL2 فهما تأخيرات شبكة تحدّها المسافة وسرعة الضوء، لذلك لا يؤثر فيهما عتاد الخادم.

The formula becomes a design argument once you put numbers in it. A client sits in New York and the server sits in a cloud data center in California. The request takes 70 ms to cross the country, the server works for 30 ms, and the reply takes another 70 ms.

تتحول المعادلة إلى حجة تصميمية عندما تضع فيها أرقامًا. عميل موجود في نيويورك والخادم في مركز بيانات سحابي في كاليفورنيا. يستغرق الطلب 70 ms لعبور البلاد، ويعمل الخادم لمدة 30 ms، ويستغرق الرد 70 ms أخرى.

Worked exampleمثال محلول

New York client, California cloudعميل في نيويورك، وسحابة في كاليفورنيا

  1. Add the three termsاجمع الحدود الثلاثة

    70 + 30 + 70 = 170 ms. This is the response time the user feels.
    70 + 30 + 70 = 170 ms. هذا هو زمن الاستجابة الذي يشعر به المستخدم.
  2. Computation shareحصة الحوسبة

    30 / 170 ≈ 17.6%. The other 140 / 170 ≈ 82% is spent on the two network trips.
    30 / 170 ≈ 17.6%. أما الباقي 140 / 170 ≈ 82% فيُستهلك في رحلتي الشبكة.
  3. Double the server speedضاعف سرعة الخادم

    PT halves from 30 ms to 15 ms, so RT becomes 70 + 15 + 70 = 155 ms.
    ينخفض PT إلى النصف من 30 ms إلى 15 ms، فيصبح RT مساويًا 70 + 15 + 70 = 155 ms.
  4. Find the ceilingأوجد السقف

    Even an infinitely fast server leaves 70 + 0 + 70 = 140 ms, a best-case speedup of only 170 / 140 ≈ 1.21x.
    حتى الخادم ذو السرعة اللانهائية يترك 70 + 0 + 70 = 140 ms، أي أن أفضل تسريع ممكن هو 170 / 140 ≈ 1.21x فقط.
  5. Resultالنتيجة

    About 9% faster (170 / 155 ≈ 1.097x) for twice the compute.
    أسرع بنحو 9% فقط (170 / 155 ≈ 1.097x) مقابل مضاعفة الحوسبة.
Network trips fill most of the 170 ms bar. Halving PT only moves the end from 170 ms to 155 ms, close to the 140 ms floor.رحلات الشبكة تملأ معظم شريط الـ 170 ms. تنصيف PT ينقل النهاية فقط من 170 ms إلى 155 ms، قريبًا من الحد الأدنى 140 ms.

Amdahl's argument, moved onto the networkحجة Amdahl منقولة إلى الشبكة

The disappointing result is not a quirk of these numbers. In 1967 Gene Amdahl pointed out that the part of a job you do not speed up places an upper limit on the overall gain, so effort on one part "is wasted unless it is accompanied by achievements" of similar size in the rest (Amdahl, 1967). Amdahl wrote no equation; the usual textbook form is below, where f is the fraction of time you improve and k is how much faster that part becomes.

هذه النتيجة المخيبة ليست مصادفة خاصة بهذه الأرقام. في عام 1967 أشار Gene Amdahl إلى أن الجزء الذي لا تسرّعه من العمل يضع حدًا أعلى للمكسب الكلي، لذلك فإن الجهد المبذول على جزء واحد "is wasted unless it is accompanied by achievements" (يضيع ما لم تصحبه إنجازات) بحجم مماثل في البقية (Amdahl, 1967). لم يكتب Amdahl معادلة، والصيغة المعتادة في الكتب أدناه، حيث f هي نسبة الوقت الذي تحسّنه وk هو مقدار تسريع ذلك الجزء.

S=1(1−f)+f/kS = \frac{1}{(1 - f) + f/k}
Amdahl's law: overall speedup when a fraction f is made k times fasterقانون Amdahl: التسريع الكلي عندما يُسرَّع جزء f بمقدار k مرة

With f = 30/170 and k = 2, the formula gives 1 / (0.8235 + 0.0882) ≈ 1.097, the same answer as the worked example. As k grows without bound the speedup approaches 1 / (1 - f), which is the 1.21x ceiling.

عندما f = 30/170 وk = 2 تعطي المعادلة 1 / (0.8235 + 0.0882) ≈ 1.097، وهي الإجابة نفسها في المثال المحلول. وكلما كبرت k بلا حد اقترب التسريع من 1 / (1 - f)، وهو سقف 1.21x.

In Mapping 1 the part you cannot improve is the network. Physics bounds L1 and L2, and Satyanarayanan notes that "the speed of light is an obvious physical limit on latency". The only large lever left is shortening the distance, which is exactly what Edge computing does. He concludes that relying on a distant data center is not advisable for applications that need end-to-end delays tightly controlled below a few tens of milliseconds (Satyanarayanan, 2017).

في التعيين 1 الجزء الذي لا تستطيع تحسينه هو الشبكة. الفيزياء تحدّ L1 وL2، ويلاحظ Satyanarayanan أن "the speed of light is an obvious physical limit on latency" (سرعة الضوء حد فيزيائي واضح لزمن التأخير). الرافعة الكبيرة الوحيدة المتبقية هي تقصير المسافة، وهذا بالضبط ما تفعله حوسبة الحافة (edge). ويخلص إلى أن الاعتماد على مركز بيانات بعيد غير مستحسن للتطبيقات التي تحتاج إلى تأخير طرفي إلى طرفي مضبوط بإحكام تحت بضع عشرات من الملي ثانية (Satyanarayanan, 2017).

Quick checkاختبار سريع

A client sees 40 ms, 40 ms and 40 ms for L1, PT and L2. The server becomes twice as fast. What is the new response time?عميل يرى 40 ms و40 ms و40 ms لكل من L1 وPT وL2. أصبح الخادم أسرع بمرتين. ما زمن الاستجابة الجديد؟

So is Mapping 1 a bad design?إذن هل التعيين 1 تصميم سيئ؟

No. The same centralization that makes it slow for far clients is what makes it attractive. With one model in one Cloud deployment, every user gets the same model version, and an update is a single deploy. The client stays thin, since it only captures and displays. Satyanarayanan describes the benefit: "centralization exploits economies of scale to lower the marginal cost of system administration and operations" (Satyanarayanan, 2017). When demand grows, you rent more machines in the same region.

لا. المركزية نفسها التي تجعله بطيئًا للعملاء البعيدين هي ما يجعله جذابًا. مع نموذج واحد في نشر واحد على cloud، يحصل كل مستخدم على نسخة النموذج نفسها، والتحديث عملية نشر واحدة. ويبقى العميل خفيفًا لأنه يلتقط ويعرض فقط. يصف Satyanarayanan الفائدة: "centralization exploits economies of scale to lower the marginal cost of system administration and operations" (المركزية تستغل وفورات الحجم لخفض التكلفة الحدية لإدارة النظام وتشغيله) (Satyanarayanan, 2017). وعندما يزداد الطلب تستأجر أجهزة أكثر في المنطقة نفسها.

Whether distance is a problem depends on the service. For photo tagging, a few hundred milliseconds are fine and Mapping 1 is often the right call. For augmented reality or a multiplayer game, where a frame must react within milliseconds, every request paying the full Latency both ways is not acceptable.

كون المسافة مشكلة أم لا يعتمد على الخدمة. في وسم الصور (photo tagging) بضع مئات من الملي ثانية مقبولة، وغالبًا ما يكون التعيين 1 هو الخيار الصحيح. أما في الواقع المعزز أو لعبة جماعية عبر الشبكة، حيث يجب أن يستجيب الإطار خلال ملي ثوانٍ، فإن دفع كل طلب لكامل latency في الاتجاهين غير مقبول.

Strengthsنقاط القوةWeaknessesنقاط الضعف
Every user gets the same model versionكل مستخدم يحصل على نسخة النموذج نفسهاFar clients pay a large L1 and L2 on every requestالعملاء البعيدون يدفعون L1 وL2 كبيرين في كل طلب
The client only sends and receives, so it stays simpleالعميل يرسل ويستقبل فقط، فيبقى بسيطًاReal-time AR and gaming miss their deadlinesتطبيقات الواقع المعزز والألعاب في الزمن الحقيقي تفوّت مواعيدها النهائية
Scaling means adding cloud machines, not touching clientsالتوسع يعني إضافة أجهزة سحابية دون المساس بالعملاءAdding machines does not shorten the pathإضافة الأجهزة لا تقصّر المسار
Mapping 1 at a glanceالتعيين 1 في لمحة

Quick checkاختبار سريع

A multiplayer game studio serves players worldwide from one cloud region. Which Mapping 1 weakness hurts it most?استوديو ألعاب جماعية يخدم اللاعبين حول العالم من منطقة سحابية واحدة. أي نقاط ضعف التعيين 1 يضرّه أكثر؟

Recall

In the New York to California example, what is the lowest RT possible if the server became infinitely fast, and what is the best possible speedup?في مثال نيويورك إلى كاليفورنيا، ما أقل RT ممكن لو أصبح الخادم لانهائي السرعة، وما أفضل تسريع ممكن؟

140 ms (70 + 0 + 70). The best possible speedup is 170 / 140, about 1.21x.
140 ms (70 + 0 + 70). وأفضل تسريع ممكن هو 170 / 140، أي نحو 1.21x.

If the network dominates, the most radical fix is to delete it. Mapping 2 runs the whole photo pipeline on the phone. Nothing is uploaded, so there is no L1 and no L2, and the response time collapses to the processing time alone.

إذا كانت الشبكة هي المهيمنة، فأكثر الحلول جذرية هو حذفها. التعيين 2 يشغّل خط معالجة الصور كله على الهاتف. لا يُرفع شيء، فلا يوجد L1 ولا L2، وينكمش زمن الاستجابة إلى زمن المعالجة وحده.

RT≈PTdeviceRT \approx PT_{device}
Mapping 2: no network terms, all cost moves into processingالتوزيع 2: لا حدود للشبكة، وتنتقل كل الكلفة إلى المعالجة

That sounds ideal until you look at what PT now means. The Client Device has a small battery-powered chip, not a data center accelerator. Resize (T1) and drawing (T3) are cheap, but object detection (T2) is heavy. On weak hardware it takes far longer, and the whole time the processor draws power from the battery. In the lecture's layer model this is the Device stage at the very start of the continuum, before Mist, with no edge, fog or cloud involved, and it is the case with no Offloading at all: the weakest component keeps all the work.

يبدو هذا مثاليًا حتى تنظر إلى ما يعنيه PT الآن. جهاز (device) العميل (client) فيه شريحة صغيرة تعمل بالبطارية، وليس مسرّعًا من مسرّعات مراكز البيانات. تغيير الحجم (T1) والرسم (T3) رخيصان، لكن اكتشاف الأجسام (T2) ثقيل. على عتاد ضعيف يستغرق وقتًا أطول بكثير، وطوال هذا الوقت يسحب المعالج الطاقة من البطارية. في نموذج الطبقات في المحاضرة هذه هي مرحلة الجهاز (Device) في بداية الاستمرارية تمامًا، قبل الضباب الخفيف (mist)، دون أي حافة أو ضباب أو سحابة، وهي الحالة التي لا يوجد فيها تفريغ للحمل (offloading) إطلاقًا: أضعف مكوّن يحتفظ بالعمل كله.

The simulator makes the trade visible. Its all-device preset shows 0 ms of network but 440 ms of processing, while the all-cloud preset shows 159 ms in total. Removing two terms from a sum does not help if the remaining term grows past what you removed.

المحاكي يجعل هذه المقايضة مرئية. إعداده المسبق «كل شيء على الجهاز» يُظهر 0 ms للشبكة لكن 440 ms للمعالجة، بينما إعداد «كل شيء في السحابة» يُظهر 159 ms إجمالًا. حذف حدّين من مجموع لا يفيد إذا كبر الحد المتبقي أكثر مما حذفت.

What the user gains is not speed but independence. With no dependency on the network, the service keeps working with no signal. The raw data never leaves the device, which reduces privacy concerns.

ما يكسبه المستخدم ليس السرعة بل الاستقلالية. بدون اعتماد على الشبكة تستمر الخدمة في العمل حتى بلا إشارة. والبيانات الخام لا تغادر الجهاز أبدًا، مما يقلل مخاوف الخصوصية.

Where it shows up: the smartwatchأين يظهر: الساعة الذكية

A smartwatch that notices you have started running is Mapping 2 in a product you can buy. The motion sensors stream data constantly, and the watch must decide on the spot. Apple's documentation, for example, says that for walking, running, swimming and other workouts "your Apple Watch senses when you're moving and alerts you to start the Workout app" (Apple Support). The page does not say where the detection runs, so treat it as an example of the feature, not as proof of an on-watch model. The general point stands: running the classifier on the Device keeps raw motion data private and works without a phone nearby, but it is bounded by battery life and a small processor.

الساعة الذكية التي تلاحظ أنك بدأت الجري هي التعيين 2 في منتج يمكنك شراؤه. حساسات الحركة تبث البيانات باستمرار، ويجب على الساعة أن تقرر في الحال. توثيق Apple مثلًا يقول إنه في المشي والجري والسباحة وتمارين أخرى "your Apple Watch senses when you're moving and alerts you to start the Workout app" (تستشعر ساعتك أنك تتحرك وتنبهك لبدء تطبيق التمرين) (Apple Support). الصفحة لا تذكر أين يجري الاكتشاف، فاعتبرها مثالًا على الميزة لا دليلًا على نموذج يعمل داخل الساعة. لكن الفكرة العامة صحيحة: تشغيل المصنِّف على device يحفظ خصوصية بيانات الحركة الخام ويعمل دون وجود هاتف قريب، لكنه محدود بعمر البطارية ومعالج صغير.

Toolkits exist precisely for this. Google's LiteRT (formerly TensorFlow Lite) runs trained models on phones and embedded boards and advertises "low latency and high privacy on billions of devices" (Google for Developers). The typical recipe is to train a large model in the cloud, then compress it until it fits the device, which attacks PT directly since it is the only term left.

توجد أدوات مصممة لهذا تحديدًا. LiteRT من Google (سابقًا TensorFlow Lite) يشغّل النماذج المدرَّبة على الهواتف واللوحات المدمجة ويَعِد بـ "low latency and high privacy on billions of devices" (زمن تأخير منخفض وخصوصية عالية على مليارات الأجهزة) (Google for Developers). الوصفة المعتادة هي تدريب نموذج كبير في السحابة، ثم ضغطه حتى يناسب الجهاز، وهذا يهاجم PT مباشرة لأنه الحد الوحيد المتبقي.

  • Choose Mapping 2 when connectivity cannot be assumed: a run in the mountains, a flight, a basement.اختر التعيين 2 عندما لا يمكن افتراض وجود اتصال: جري في الجبال، أو رحلة طيران، أو قبو.
  • Choose it when raw data is sensitive and should not leave the device, such as health signals.اختره عندما تكون البيانات الخام حساسة ولا ينبغي أن تغادر الجهاز، مثل الإشارات الصحية.
  • Choose it only when the model is small enough that PT and battery drain stay acceptable.اختره فقط عندما يكون النموذج صغيرًا بما يكفي ليبقى PT واستنزاف البطارية مقبولين.

Quick checkاختبار سريع

What cost does a smartwatch pay under Mapping 2 that it avoids under Mapping 1?ما التكلفة التي تدفعها الساعة الذكية في التعيين 2 وتتجنبها في التعيين 1؟

Recall

Name two impacts of Mapping 2 on the device itself, and one benefit.اذكر أثرين للتعيين 2 على الجهاز نفسه، وفائدة واحدة.

It consumes the device's processing power and its battery. Benefits: no network dependency, and better privacy because data is processed locally.
يستهلك القدرة المعالجة للجهاز وبطاريته. الفوائد: لا اعتماد على الشبكة، وخصوصية أفضل لأن البيانات تُعالج محليًا.

Mappings 1 and 2 sit at the two extremes: a strong server far away, or a weak processor with no network. Mapping 3 looks for the middle. It keeps a real server but moves it close, into the same building or a nearby telecom site, which runs all three tasks and sends the result back.

التعيينان 1 و2 يقعان في الطرفين: خادم قوي بعيد، أو معالج ضعيف بلا شبكة. التعيين 3 يبحث عن الوسط. يبقي على خادم حقيقي لكنه يقرّبه، إلى المبنى نفسه أو موقع اتصالات قريب، وهذا الخادم يشغّل المهام الثلاث ويعيد النتيجة.

Both halves of the formula improve at once. Because the Server is close, L1 and L2 are small. Because it is a real server rather than a phone, PT is moderate. The simulator's all-edge preset shows 10 ms of network and 136 ms of processing, so 146 ms in total. Satyanarayanan's cloudlet idea is this design: a small data center near users that "can run arbitrary code just as in cloud computing", where "proximity of cloudlets to end users is crucial" (Satyanarayanan, 2017). The work is still offloaded from the device, but to a nearby point on the continuum instead of the far end.

يتحسن نصفا المعادلة معًا. لأن server قريب، يكون L1 وL2 صغيرين. ولأنه خادم حقيقي وليس هاتفًا، يكون PT معتدلًا. إعداد المحاكي «كل شيء على الحافة» يُظهر 10 ms للشبكة و136 ms للمعالجة، أي 146 ms إجمالًا. فكرة cloudlet لدى Satyanarayanan هي هذا التصميم: مركز بيانات صغير قرب المستخدمين "can run arbitrary code just as in cloud computing" (يستطيع تشغيل أي كود كما في الحوسبة السحابية)، حيث "proximity of cloudlets to end users is crucial" (قرب هذه المراكز من المستخدمين أمر حاسم) (Satyanarayanan, 2017). العمل لا يزال مُفرَّغًا (offloaded) من الجهاز، لكن إلى نقطة قريبة على الاستمرارية (continuum) بدلًا من طرفها البعيد.

An edge site serves the users inside its coverage area. Users outside the rings cannot benefit from its low latency.موقع الحافة يخدم المستخدمين داخل منطقة تغطيته. المستخدمون خارج الحلقات لا يستفيدون من زمن تأخيره المنخفض.

Proximity has two prices, and both follow from the same fact that made the latency low. First, limited geographic reach: an Edge site is close to some users precisely because it is far from everyone else, who either get no service or a long trip. Second, limited scalability: an edge site is small, a few servers in a closet or a cabinet, so it cannot absorb a large workload the way a cloud region can. Covering a country means many small sites, each managed separately, which gives back the centralization that made Mapping 1 easy to operate.

للقرب ثمنان، وكلاهما ينبع من الحقيقة نفسها التي جعلت زمن التأخير منخفضًا. الأول، محدودية النطاق الجغرافي: موقع الحافة (edge) قريب من بعض المستخدمين تحديدًا لأنه بعيد عن الجميع غيرهم، فهؤلاء إما لا يحصلون على خدمة أو يقطعون رحلة طويلة. الثاني، محدودية قابلية التوسع: موقع الحافة صغير، بضعة خوادم في غرفة صغيرة أو خزانة، لذلك لا يستطيع استيعاب حمل كبير كما تفعل منطقة سحابية. تغطية دولة كاملة تعني مواقع صغيرة كثيرة، يُدار كل منها على حدة، وهذا يتخلى عن المركزية التي جعلت تشغيل التعيين 1 سهلًا.

Where it shows up: the retail storeأين يظهر: متجر التجزئة

Cameras and shelf sensors in a store feed a server in the back office. It counts footfall, notices which products customers pick up, and tracks inventory as it changes. The decisions are local and time-sensitive: restock a shelf now, open a second checkout because the queue is growing. Sending every video frame to a distant cloud would add Latency and upload a lot of footage, so the edge server answers in the store.

الكاميرات وحساسات الرفوف في المتجر تغذي خادمًا في المكتب الخلفي. يعدّ هذا الخادم الزوار، ويلاحظ أي منتجات يلتقطها الزبائن، ويتتبع المخزون أثناء تغيّره. القرارات محلية وحساسة للوقت: أعد ملء رف الآن، افتح صندوق دفع ثانيًا لأن الطابور يطول. إرسال كل إطار فيديو إلى سحابة بعيدة سيضيف latency ويرفع كمية كبيرة من اللقطات، لذلك يجيب خادم الحافة داخل المتجر.

Now test the two weaknesses against it. Could that back-office box serve a branch in another city? No, its users are the cameras and staff in this store. That is limited reach. Could it absorb the peak traffic of a hundred stores on a sales weekend? No, it is sized for one store. That is limited scalability. The store is a good fit precisely because neither weakness matters for its workload.

الآن اختبر نقطتي الضعف عليه. هل يستطيع ذلك الجهاز في المكتب الخلفي خدمة فرع في مدينة أخرى؟ لا، فمستخدموه هم كاميرات هذا المتجر وموظفوه. هذه محدودية النطاق. هل يستطيع استيعاب ذروة حركة مئة متجر في عطلة تخفيضات؟ لا، فهو مصمم بحجم متجر واحد. هذه محدودية قابلية التوسع. المتجر مناسب تمامًا لأن أيًا من نقطتي الضعف لا تهم في حمل عمله.

Recall

Why can an edge server in one store not replace a cloud service for a national chain? And where would chain-wide sales trends be computed?لماذا لا يستطيع خادم حافة في متجر واحد أن يحل محل خدمة سحابية لسلسلة متاجر وطنية؟ وأين تُحسب اتجاهات المبيعات على مستوى السلسلة كلها؟

Limited geographic reach (it serves only nearby users and devices) and limited scalability (a small site cannot absorb large workloads). Chain-wide trends need data from every store, so they are typically computed in the cloud, which the last section of this part returns to.
بسبب محدودية النطاق الجغرافي (يخدم المستخدمين والأجهزة القريبة فقط) ومحدودية قابلية التوسع (الموقع الصغير لا يستوعب أحمالًا كبيرة). اتجاهات السلسلة كلها تحتاج إلى بيانات من كل متجر، لذلك تُحسب عادة في السحابة، وهو ما يعود إليه القسم الأخير من هذا الجزء.

So far each mapping put the whole pipeline in one place. But the three tasks are not equally demanding, so why should they share a layer? Mapping 4 splits the pipeline: the light tasks stay near the user and the heavy task runs one tier up. T1 (resize) and T3 (draw) run in the Edge layer, and T2 (object detection) runs in the Fog layer, which has more compute.

حتى الآن وضع كل تعيين خط المعالجة كله في مكان واحد. لكن المهام الثلاث ليست متساوية في متطلباتها، فلماذا تشترك في طبقة واحدة؟ التعيين 4 يقسّم خط المعالجة: المهام الخفيفة تبقى قرب المستخدم والمهمة الثقيلة تعمل في طبقة أعلى. T1 (تغيير الحجم) وT3 (الرسم) تعملان في طبقة الحافة (edge)، وT2 (اكتشاف الأجسام) تعمل في طبقة الضباب (fog) التي لديها قدرة حسابية أكبر.

Mapping 4: T1 and T3 land in the edge lane, T2 lands in the fog lane, and the data crosses between them twice.التعيين 4: تقع T1 وT3 في مسار الحافة، وتقع T2 في مسار الضباب، وتعبر البيانات بينهما مرتين.

Think of it as one logical service deployed in two physical places. The Service pipeline is now distributed, so the formula has to grow. Count the hops: client to edge, edge to fog, fog to edge, edge to client. That is four network crossings instead of two, and each task contributes its own processing term.

فكّر فيه كخدمة منطقية واحدة منشورة في مكانين فعليين. خط المعالجة (pipeline) أصبح موزعًا، فلا بد أن تكبر المعادلة. عُدّ القفزات: من العميل إلى الحافة، ومن الحافة إلى الضباب، ومن الضباب إلى الحافة، ومن الحافة إلى العميل. هذه أربعة عبورات للشبكة بدلًا من اثنين، وكل مهمة تساهم بحد معالجة خاص بها.

RT=Lc→e+PT1+Le→f+PT2+Lf→e+PT3+Le→cRT = L_{c \to e} + PT_1 + L_{e \to f} + PT_2 + L_{f \to e} + PT_3 + L_{e \to c}
Response time for Mapping 4: four latency terms and three processing termsزمن الاستجابة للتوزيع 4: أربعة حدود لزمن الانتقال وثلاثة حدود للمعالجة

In the simulator's Mapping 4 preset, those crossings add up to 40 ms and processing to 56 ms, so 96 ms, the lowest of the four presets. The fog does T2 much faster than the edge, and that saving outweighs the two extra hops. NIST describes fog nodes as sitting "between smart end-devices and centralized (cloud) services" and says fog "minimizes the request-response time" (NIST SP 500-325).

في الإعداد المسبق للتعيين 4 في المحاكي، مجموع هذه العبورات 40 ms والمعالجة 56 ms، أي 96 ms، وهو الأقل بين الإعدادات الأربعة. الضباب ينفذ T2 أسرع بكثير من الحافة، وهذا التوفير يفوق القفزتين الإضافيتين. تصف NIST عقد الضباب بأنها تقع "between smart end-devices and centralized (cloud) services" (بين الأجهزة الطرفية الذكية والخدمات المركزية السحابية) وتقول إن الضباب "minimizes the request-response time" (يقلل زمن الطلب والاستجابة) (NIST SP 500-325).

What sharing a fog node buysما الذي تكسبه من مشاركة عقدة ضباب

Speed is only part of the case. Picture ten intersections in a smart city. Each traffic camera has a small edge box that resizes frames. All ten send them to one nearby fog server, which runs a large vehicle detection model for all of them and returns detections to each box.

السرعة ليست إلا جزءًا من الحجة. تخيّل عشرة تقاطعات في مدينة ذكية. لكل كاميرا مرور صندوق حافة صغير يغيّر حجم الإطارات. الصناديق العشرة كلها ترسل الإطارات إلى خادم ضباب قريب واحد، يشغّل نموذجًا كبيرًا لاكتشاف المركبات لها جميعًا ويعيد نتائج الاكتشاف إلى كل صندوق.

Several edge cameras send resized frames to one fog node, which runs the shared model and returns detections to each edge box, while the cloud stays idle.عدة كاميرات حافة ترسل إطارات مصغّرة إلى عقدة ضباب واحدة تشغّل النموذج المشترك وتعيد نتائج الاكتشاف إلى كل صندوق حافة، بينما تبقى السحابة خاملة.
  1. Sharing: one detection model serves users of many edge nodes, instead of a copy squeezed onto each small box.المشاركة: نموذج اكتشاف واحد يخدم مستخدمي عقد حافة كثيرة، بدلًا من نسخة محشورة في كل صندوق صغير.
  2. Capacity: the fog node has more processing power and storage than any single edge site.السعة: عقدة الضباب لديها قدرة معالجة وتخزين أكبر من أي موقع حافة منفرد.
  3. Learning: the fog collects data from all the edge nodes, which keeps the model up to date, for example by retraining on new traffic patterns.التعلّم: يجمع الضباب البيانات من كل عقد الحافة، مما يبقي النموذج محدّثًا، مثلًا بإعادة تدريبه على أنماط مرور جديدة.

This matches how NIST frames fog. Fog nodes support "a common data management and communication system" and are organized in clusters by their "latency-distance to the smart end-devices" (NIST SP 500-325). Aggregation and coordination are the fog's job, which partly restores the centralization that Mapping 3 gave up, without going all the way to the cloud.

هذا يتوافق مع طريقة NIST في تأطير الضباب. عقد الضباب تدعم "a common data management and communication system" (نظامًا مشتركًا لإدارة البيانات والاتصال) وتُنظَّم في عناقيد بحسب "latency-distance to the smart end-devices" (مسافتها الزمنية من الأجهزة الطرفية الذكية) (NIST SP 500-325). التجميع والتنسيق هما وظيفة الضباب، وهذا يعيد جزئيًا المركزية التي تخلى عنها التعيين 3، دون الذهاب حتى السحابة.

What splitting costsما تكلفة التقسيم

  • The fog layer introduces latency relative to Mapping 3: every boundary between layers adds its own latency, with all four delay components. The fog is still much closer than the Cloud.طبقة الضباب تضيف زمن تأخير مقارنة بالتعيين 3: كل حد فاصل بين الطبقات يضيف زمن تأخيره الخاص بمكوّنات التأخير الأربعة كلها. ومع ذلك يبقى الضباب أقرب بكثير من السحابة (cloud).
  • Every byte that crosses a boundary may be billed. Cloud providers already charge this way: AWS states that "there is a charge for data transfer across Regions" and that "data transfer from AWS to the internet is charged" (AWS Architecture Blog). Those quotes are about regions and the internet, not edge to fog links, but the principle carries over.كل بايت يعبر حدًا فاصلًا قد يُحاسَب عليه. مزودو السحابة يفعلون هذا أصلًا: تذكر AWS أن "there is a charge for data transfer across Regions" (هناك رسوم لنقل البيانات بين المناطق) وأن "data transfer from AWS to the internet is charged" (نقل البيانات من AWS إلى الإنترنت مدفوع) (AWS Architecture Blog). هذان الاقتباسان عن المناطق والإنترنت، لا عن الوصلات بين الحافة والضباب، لكن المبدأ نفسه ينطبق.
  • So split where a task shrinks the data. Resizing before sending means fewer bytes cross the edge to fog link, which is exactly why T1 stays at the edge.لذلك قسّم عند المهمة التي تقلّص البيانات. تغيير الحجم قبل الإرسال يعني بايتات أقل تعبر وصلة الحافة إلى الضباب، وهذا بالضبط سبب بقاء T1 على الحافة.

Quick checkاختبار سريع

Compared with Mapping 3, what new cost does Mapping 4 introduce?مقارنة بالتعيين 3، ما التكلفة الجديدة التي يضيفها التعيين 4؟

Recall

List three benefits of putting T2 in the fog, and the price paid.اذكر ثلاث فوائد لوضع T2 في الضباب، والثمن المدفوع.

The model is shared across edge nodes, there is more compute and storage, and data is aggregated to keep the model current. The price is the extra edge to fog hops, which add latency and data transfer.
النموذج مشترك بين عقد الحافة، وهناك قدرة حسابية وتخزين أكبر، والبيانات تُجمَّع لإبقاء النموذج محدّثًا. والثمن هو القفزات الإضافية بين الحافة والضباب، التي تضيف زمن تأخير ونقل بيانات.

The four mappings are clean teaching cases. Practice is messier in one specific way: a dedicated fog tier is not always deployed, or identified, as a separate layer. In most cases, architects use two layers, Edge and Cloud.

التعيينات الأربعة حالات تعليمية نظيفة. الواقع أكثر فوضى في نقطة محددة: طبقة الضباب المخصصة لا تُنشر دائمًا، أو لا تُعرَّف دائمًا، كطبقة منفصلة. في معظم الحالات يستخدم المعماريون طبقتين، الحافة (edge) والسحابة (cloud).

NIST agrees that fog is optional: it "is not perceived as a mandatory layer", and "different usecase scenarios might have different architectures" (NIST SP 500-325). The claim that "most" architects choose edge plus cloud is the lecturer's observation from practice. No industry-wide statistic backs the exact share.

تتفق NIST على أن الضباب اختياري: فهو "is not perceived as a mandatory layer" (لا يُعدّ طبقة إلزامية)، و"different usecase scenarios might have different architectures" (سيناريوهات الاستخدام المختلفة قد تكون لها معماريات مختلفة) (NIST SP 500-325). أما القول بأن «معظم» المعماريين يختارون الحافة مع السحابة فهو ملاحظة المحاضر من الممارسة. لا توجد إحصائية على مستوى الصناعة تدعم النسبة الدقيقة.

The resulting design has the shape of Mapping 4 with the cloud in place of the Fog: T1 and T3 at the edge, T2 in the cloud. It borrows the strength of each earlier mapping for the task that needs it. Go back to the retail store. The back-office edge server makes the live decisions, as in Mapping 3, and the cloud trains new models and computes trends across the whole chain, using the centralization that made Mapping 1 attractive. Each task gets the Layer that suits it.

التصميم الناتج له شكل التعيين 4 مع السحابة بدلًا من الضباب (fog): T1 وT3 على الحافة، وT2 في السحابة. إنه يستعير نقطة قوة كل تعيين سابق للمهمة التي تحتاجها. عد إلى متجر التجزئة. خادم الحافة في المكتب الخلفي يتخذ القرارات الحية كما في التعيين 3، والسحابة تدرّب نماذج جديدة وتحسب الاتجاهات عبر السلسلة كلها، مستفيدة من المركزية التي جعلت التعيين 1 جذابًا. كل مهمة تحصل على الطبقة (layer) التي تناسبها.

MappingالتعيينWhere T1, T2, T3 runأين تعمل T1 وT2 وT3Strengthsنقاط القوةWeaknessesنقاط الضعفExampleمثال
11All in the cloudكل شيء في السحابةConsistency, simple client, easy scalingاتساق النسخة، وعميل بسيط، وسهولة التوسعLarge L1 and L2, unfit for AR or gamingL1 وL2 كبيران، وغير مناسب للواقع المعزز أو الألعابPhoto tagging in a distant data centerوسم الصور في مركز بيانات بعيد
22All on the deviceكل شيء على الجهازNo network, privacy, works offlineلا شبكة، وخصوصية، ويعمل دون اتصالBattery, limited hardware, long PTالبطارية، والعتاد المحدود، وطول PTSmartwatch activity recognitionالتعرّف على النشاط في الساعة الذكية
33All at the edgeكل شيء على الحافةLow latency, data stays localزمن تأخير منخفض، والبيانات تبقى محليةLimited reach, limited scalabilityنطاق محدود، وقابلية توسع محدودةRetail store analyticsتحليلات متاجر التجزئة
44T1 edge, T2 fog, T3 edgeT1 على الحافة، وT2 في الضباب، وT3 على الحافةShared model, more compute, model updatesنموذج مشترك، وقدرة حسابية أكبر، وتحديث النموذجExtra inter-layer hops and transfer costقفزات إضافية بين الطبقات وتكلفة نقل البياناتSmart-city traffic camerasكاميرات المرور في المدينة الذكية
The four mappings side by sideالتعيينات الأربعة جنبًا إلى جنب

Quick checkاختبار سريع

According to the lecture, which two layers do most application architects deploy?بحسب المحاضرة، ما الطبقتان اللتان ينشرهما معظم معماريي التطبيقات؟

Recapالخلاصة

If you remember nothing elseإن لم تتذكر شيئاً آخر فتذكّر هذا

  • A mapping assigns each pipeline task to a continuum layer. It is a design decision, not a given.التعيين يُسند كل مهمة في خط المعالجة إلى طبقة من طبقات الاستمرارية. إنه قرار تصميمي وليس أمرًا مفروضًا.
  • RT = L1 + PT + L2. In the New York to California example, only 17.6% of 170 ms is computation.RT = L1 + PT + L2. في مثال نيويورك إلى كاليفورنيا، الحوسبة لا تتجاوز 17.6% من 170 ms.
  • Doubling server speed gives 155 ms, and even an infinitely fast server leaves 140 ms. Shorten the distance instead.مضاعفة سرعة الخادم تعطي 155 ms، وحتى الخادم ذو السرعة اللانهائية يترك 140 ms. الحل هو تقصير المسافة.
  • Mapping 2 removes the network but pays in battery, hardware limits and long PT.التعيين 2 يلغي الشبكة لكنه يدفع الثمن من البطارية وحدود العتاد وطول PT.
  • Mapping 3 cuts latency but serves only a local area with limited capacity.التعيين 3 يخفض زمن التأخير لكنه يخدم منطقة محلية فقط بسعة محدودة.
  • Mapping 4 shares a fog model across edge nodes but adds hops, latency and data transfer.التعيين 4 يشارك نموذجًا في الضباب بين عدة عقد حافة لكنه يضيف قفزات وزمن تأخير ونقل بيانات.
  • Fog is optional. Most architectures combine edge and cloud.الضباب اختياري. معظم المعماريات تجمع بين الحافة والسحابة.

Sourcesالمصادر