Lecture 02 · E2C Continuum and Cloud Computing
المحاضرة 02 · E2C Continuum والحوسبة السحابية
SLAs, nines and availability math
اتفاقيات مستوى الخدمة (SLAs) والتسعات وحساب التوفّر
P1 MUSTP1 ضروريOne formula for downtime, one for chains, one for replicas. This is the most computable topic in lecture 02, so work every example with a pen.
معادلة واحدة لوقت التوقف، وواحدة للسلاسل، وواحدة للنسخ المتكررة. هذا أكثر موضوع قابل للحساب في المحاضرة الثانية، فاحسب كل مثال بالقلم.
Availability
التوفّر (Availability)
Slide 64: availability is the percentage of time the system is available for use. Uptime is the time the application can serve requests; downtime is the time it cannot.
الشريحة 64: التوافرية (availability) هي نسبة الوقت الذي يكون فيه النظام متاحاً للاستخدام. الـ uptime هو الوقت الذي يستطيع فيه التطبيق خدمة الطلبات، والـ downtime هو الوقت الذي لا يستطيع فيه ذلك.
Three readings of the same number. The first is the slide's definition, by time. The second is how big providers actually measure it, by requests. The third is a design-time estimate from failure statistics: mean time between failures and mean time to recover.
ثلاث قراءات للرقم نفسه. الأولى هي تعريف الشريحة بالوقت. والثانية هي كيف يقيسه المزوّدون الكبار فعلاً، بعدد الطلبات. والثالثة تقدير وقت التصميم من إحصاءات الأعطال: متوسط الوقت بين الأعطال (MTBF) ومتوسط وقت التعافي (MTTR).
Rearranged, the definition gives the formula you will use most: the downtime a promise allows over any period T.
وبإعادة ترتيب التعريف نحصل على المعادلة الأكثر استخداماً: وقت التوقف المسموح به في أي فترة T.
BY TIME 30-day month = 720 h, down twice for 2 h total A = 718 / 720 = 0.99722 = 99.72% BY REQUESTS 2,500,000 requests a day, target 99.99% allowed failures = (1 − 0.9999) × 2,500,000 = 250 BY MTBF / MTTR fails every 150 days = 3600 h, recovers in 1 h A = 3600 / (3600 + 1) = 0.99972 = 99.97% halve MTTR to 0.5 h: 3600 / 3600.5 = 0.99986
Two levers raise availability: fail less often (raise MTBF) or recover faster (cut MTTR). Halving MTTR buys as much as doubling MTBF.
رافعتان ترفعان التوافرية: أن يقل تكرار العطل (رفع MTBF) أو أن يكون التعافي أسرع (خفض MTTR). وتنصيف MTTR يعطي الأثر نفسه لمضاعفة MTBF.
The nines table
جدول التسعات
Slide 65. Each extra nine makes the unavailability (1 − A) ten times smaller, so every downtime figure shrinks tenfold. The slide assumes a 365-day year (8760 h), a 30-day month (720 h) and a 7-day week (168 h).
الشريحة 65. كل تسعة إضافية تجعل عدم التوافر (1 − A) أصغر بعشر مرات، فيصغر كل رقم توقف عشرة أضعاف. تفترض الشريحة سنة من 365 يوماً (8760 h)، وشهراً من 30 يوماً (720 h)، وأسبوعاً من 7 أيام (168 h).
| Availabilityالتوفّر | 1 − A | Per yearفي السنة | Per 30-day monthفي شهر من 30 يوماً | Per weekفي الأسبوع | Per dayفي اليوم |
|---|---|---|---|---|---|
| 99% (two nines)99% (تسعتان) | 0.01 | 3.65 days3.65 يوم | 7.2 h | 1.68 h | 14.4 min |
| 99.9% (three nines)99.9% (ثلاث تسعات) | 0.001 | 8.76 h | 43.2 min | 10.1 min | 1.44 min |
| 99.99% (four nines)99.99% (أربع تسعات) | 0.0001 | 52.56 min | 4.32 min | 1.01 min | 8.64 s |
| 99.999% (five nines)99.999% (خمس تسعات) | 0.00001 | 5.26 min | 25.9 s | 6.05 s | 0.86 s |
| 99.9999% (six nines)99.9999% (ست تسعات) | 0.000001 | 31.5 s | 2.59 s | 0.605 s | 0.086 s |
في الجدول، كل صف هو الصف الذي فوقه مقسوماً على 10. أهم الأرقام للحفظ: 99% تساوي 3.65 يوماً في السنة، و99.9% تساوي 8.76 ساعة في السنة و43.2 دقيقة في شهر من 30 يوماً، و99.99% تساوي 52.56 دقيقة في السنة، و99.999% تساوي 5.26 دقيقة في السنة.
99.9% per year: 0.001 × 8760 h = 8.76 h 99.9% per month: 0.001 × 43,200 min = 43.2 min 99.99% per year: 0.0001 × 525,600 min = 52.56 min 99.999% per year: 0.00001 × 525,600 min = 5.256 min 99.95% per month: 0.0005 × 43,200 min = 21.6 min 99% per year: 0.01 × 365 days = 3.65 days
You never need to memorise the whole table: anchor on 99.9% = 8.76 h a year, then slide the decimal point one place per nine.
لا تحتاج إلى حفظ الجدول كله: ثبّت نقطة الارتكاز 99.9% = 8.76 h في السنة، ثم حرّك الفاصلة العشرية منزلة واحدة لكل تسعة.
Series: the compound SLA
التوالي (Series): الـ SLA المركّبة
Slide 66. A request passes through Service 1 (99.99%) and then Service 2 (99.9%). It succeeds only if both are up. With independent failures, the probability both are up is the product.
الشريحة 66. يمر الطلب عبر الخدمة الأولى (99.99%) ثم الخدمة الثانية (99.9%). ولا ينجح إلا إذا كانت الخدمتان تعملان. ومع استقلال الأعطال، يكون احتمال عمل الاثنتين هو حاصل الضرب.
The answer is below the weakest link, not between the two. Multiplying by any number at most 1 can only keep a value or lower it. Shortcut when all unavailabilities are small: add them. 0.01% + 0.1% = 0.11%, so about 99.89%.
الناتج أقل من أضعف حلقة، وليس بين الرقمين. فالضرب في أي عدد لا يتجاوز 1 إما أن يُبقي القيمة أو يخفضها. اختصار عندما تكون كل نسب عدم التوافر صغيرة: اجمعها. 0.01% + 0.1% = 0.11%، أي نحو 99.89%.
Parallel: redundant replicas
التوازي (Parallel): نسخ متماثلة احتياطية
Put independent replicas behind automatic failover so any one can serve. Now the system fails only if all replicas are down at once, so you multiply the unavailabilities.
ضع نسخاً مستقلة خلف آلية تحويل تلقائي (failover) بحيث تستطيع أي نسخة الخدمة. الآن لا يتعطل النظام إلا إذا تعطلت كل النسخ معاً، فتضرب نسب عدم التوافر.
| Topologyالبنية | Formulaالصيغة | Two components at 99.9%مكوّنان كل منهما 99.9% | When it appliesمتى تنطبق |
|---|---|---|---|
| Seriesالتوالي | A = A1 × A2 | 0.999² = 99.8001% | Every stage must work (hard dependencies)يجب أن تعمل كل مرحلة (اعتماديات صلبة) |
| Parallelالتوازي | A = 1 − (1 − A1)(1 − A2) | 1 − 0.001² = 99.9999% | Any one replica can serve, failover is automaticأي نسخة واحدة تكفي للخدمة، والتحويل عند العطل (failover) تلقائي |
المكوّنان نفساهما بتوافرية 99.9% لكل منهما يعطيان 99.8001% على التوالي (series)، و99.9999% على التوازي (parallel). التوالي يضرب التوافريات، والتوازي يضرب نسب عدم التوافر. وكلا المعادلتين تفترض أن الأعطال مستقلة.
load balancer 99.99% → web tier: 2 replicas at 99.9% → database 99.95%
step 1 collapse the parallel block first
web = 1 − 0.001 × 0.001 = 0.999999
step 2 multiply the series chain
A = 0.9999 × 0.999999 × 0.9995
= 0.99940005 × 0.999999
≈ 0.999399 ≈ 99.94%
step 3 convert to a downtime budget (30-day month)
D = (1 − 0.999399) × 43,200 min
= 0.000601 × 43,200 ≈ 26 min per month
The replicated web tier now contributes almost nothing; the database (the weakest single link) dominates. Collapse parallel groups first, then multiply along the chain.
طبقة الويب المكرّرة أصبحت لا تُسهم بشيء تقريباً، وقاعدة البيانات (أضعف حلقة منفردة) هي المهيمنة. اختزل مجموعات التوازي أولاً، ثم اضرب على طول السلسلة.
five services at 99.9% in series A = 0.999⁵ ≈ 0.99501 ≈ 99.50% yearly downtime = 0.00499 × 8760 h ≈ 43.7 h versus 8.76 h for a single 99.9% service
خمس خدمات بتوافرية 99.9% على التوالي تعطي 0.999⁵ ≈ 99.50%، أي نحو 43.7 h توقفاً في السنة، مقابل 8.76 h لخدمة واحدة. كل اعتمادية صلبة تضيفها تستهلك جزءاً من الميزانية.
From compound SLA to minutes: the slide 67 calculator
من الـ SLA المركّبة إلى الدقائق: حاسبة الشريحة 67
Slide 67 feeds the compound 99.89% into uptime.is. Do it by hand with 1 − A = 0.0011.
الشريحة 67 تُدخل الناتج المركّب 99.89% في uptime.is. احسبه يدوياً بـ 1 − A = 0.0011.
| Periodالفترة | By hand (0.0011 × T)يدوياً (0.0011 × T) | uptime.is todayuptime.is اليوم | Slide 67 screenshotلقطة الشريحة 67 |
|---|---|---|---|
| Day (86,400 s)يوم (86,400 s) | 95.0 s = 1m 35s | 1m 35s | 1m 35s |
| Week (604,800 s)أسبوع (604,800 s) | 665 s = 11m 5s | 11m 5.3s | 11m 5.3s |
| Monthشهر | 47m 31s (30 days)47m 31s (30 يوماً) | 48m 13s (30.44 days)48m 13s (30.44 يوماً) | 47m 49s |
| Quarterربع سنة | 2h 22m 34s (90 days)2h 22m 34s (90 يوماً) | 2h 24m 38s | 2h 23m 27s |
| Yearسنة | 9h 38m (365 days)9h 38m (365 يوماً) | 9h 38m 33s | 9h 33m 48s |
الأرقام اليومية والأسبوعية تتفق في المصادر الثلاثة. أما الشهرية فتختلف بحسب طول الشهر: 30 يوماً تعطي 47m 31s، ومتوسط الشهر الميلادي (نحو 30.44 يوماً) يعطي 48m 13s. وأرقام لقطة الشريحة الشهرية والفصلية والسنوية تطابق نحو 0.1091% لا 0.11%، أي أنها غير متسقة مع أرقامها اليومية والأسبوعية.
SLI, SLO, SLA
SLI
Service Level Indicator: the measurement. Example: fraction of valid requests that succeeded in a 5-minute window.
SLI هو المؤشر، أي القياس نفسه. مثال: نسبة الطلبات الصالحة التي نجحت خلال نافذة من 5 دقائق.
SLO
Service Level Objective: an internal target for an SLI, such as 99.95% per month. Missing it triggers engineering work, not payments.
SLO هو الهدف: هدف داخلي لقيمة SLI، مثل 99.95% شهرياً. تفويته يستدعي عملاً هندسياً، لا دفع تعويضات.
SLA
Service Level Agreement: a contract with the customer that names SLOs and the consequences of missing them. No consequence, no SLA.
SLA هو الاتفاقية: عقد مع العميل يحدد أهداف SLO وعواقب تفويتها. بلا عواقب لا توجد SLA.
EC2 commits to 99.99% monthly uptime for instances spread across a region (only 99.5% for a single instance). Below 99.99% you get a service credit of 10% of the month's bill, 30% below 99.0%, and 100% below 95.0%. Credits are the sole remedy; your lost business is never compensated.
تلتزم EC2 بتوافرية شهرية 99.99% للأجهزة الموزعة على منطقة كاملة (و99.5% فقط لجهاز منفرد). إذا نزلت عن 99.99% تحصل على رصيد خدمة (service credit) قدره 10% من فاتورة الشهر، و30% تحت 99.0%، و100% تحت 95.0%. الرصيد هو التعويض الوحيد، وخسارة عملك لا تُعوَّض أبداً.
"Indicator measures, Objective aims, Agreement pays." And for topology: series multiplies the A's, parallel multiplies the (1 − A)'s.
"Indicator measures, Objective aims, Agreement pays." أي: المؤشر يقيس، والهدف يطمح، والاتفاقية تدفع. وللبنية: التوالي يضرب قيم A، والتوازي يضرب قيم (1 − A).
Series vs parallel formulas. Series: product of availabilities, result below the weakest. Parallel: one minus the product of unavailabilities, result above the best. Using the series formula for replicas (0.999 × 0.999 = 99.8%) is the classic slip: it says adding a backup made things worse.
معادلتا التوالي والتوازي. التوالي: حاصل ضرب التوافريات، والناتج أقل من الأضعف. التوازي: واحد ناقص حاصل ضرب نسب عدم التوافر، والناتج أعلى من الأفضل. استخدام معادلة التوالي للنسخ المتكررة (0.999 × 0.999 = 99.8%) هو الخطأ الكلاسيكي، لأنه يعني أن إضافة نسخة احتياطية جعلت الوضع أسوأ.
State the period convention. 99.9% is 43.2 min in a 30-day month but about 43.8 min in an average 30.44-day month. Write D = (1 − A) × T with your T, and both answers earn the mark.
صرّح بطول الفترة. 99.9% تساوي 43.2 min في شهر من 30 يوماً، لكنها نحو 43.8 min في شهر متوسطه 30.44 يوماً. اكتب D = (1 − A) × T مع قيمة T التي اخترتها، فتنال الدرجة في الحالتين.
SLA vs SLO matching. The one with consequences (credits, penalties) is the SLA. The internal target is the SLO. The measured number is the SLI. Also: slide 66's second box is mislabelled "Service 1"; it is Service 2 at 99.9%.
التوصيل بين SLA وSLO. الذي له عواقب (أرصدة، غرامات) هو SLA. والهدف الداخلي هو SLO. والرقم المقاس هو SLI. وأيضاً: الصندوق الثاني في الشريحة 66 مكتوب عليه خطأً "Service 1"، وهو في الحقيقة Service 2 بتوافرية 99.9%.
Check yourself
اختبر نفسك
A service promises 99.9% availability. How much downtime does it allow per 30-day month?
خدمة تعد بتوافرية 99.9%. كم وقت توقف تسمح به في شهر من 30 يوماً؟
C. D = (1 − 0.999) × 43,200 min = 0.001 × 43,200 = 43.2 min. A is the monthly figure for 99.99%, B for 99%, and D is the yearly (not monthly) figure for 99.9%.
الجواب C. D = (1 − 0.999) × 43,200 min = 0.001 × 43,200 = 43.2 min. الخيار A هو الرقم الشهري لـ 99.99%، وB لـ 99%، وD هو الرقم السنوي (لا الشهري) لـ 99.9%.
Service 1 (99.99%) and Service 2 (99.9%) are hard dependencies in series. What is the compound SLA?
الخدمة الأولى (99.99%) والثانية (99.9%) اعتماديتان صلبتان على التوالي. ما قيمة compound SLA؟
B. 0.9999 × 0.999 = 0.9989001, about 99.89%. A series chain is never better than its weakest link. C averages, which has no basis. D applies the parallel formula, but these are not redundant replicas: the request needs both.
الجواب B. 0.9999 × 0.999 = 0.9989001، أي نحو 99.89%. السلسلة على التوالي لا تكون أبداً أفضل من أضعف حلقة. الخيار C يأخذ المتوسط بلا أساس. والخيار D يطبق معادلة التوازي، لكن هاتين ليستا نسختين متكررتين، فالطلب يحتاج إلى الاثنتين.
Two independent replicas, each 99% available, sit behind automatic failover. What is the system availability?
نسختان مستقلتان، توافرية كل منهما 99%، خلف آلية تحويل تلقائي. ما توافرية النظام؟
D. Parallel: 1 − (0.01 × 0.01) = 1 − 0.0001 = 0.9999. Quick check: count the nines, 2 + 2 = 4. A is 0.99², the series formula wrongly applied to replicas.
الجواب D. توازٍ: 1 − (0.01 × 0.01) = 1 − 0.0001 = 0.9999. تحقق سريع: اجمع التسعات، 2 + 2 = 4. الخيار A هو 0.99²، أي معادلة التوالي مطبّقة خطأً على النسخ المتكررة.
A component has MTBF = 999 hours and MTTR = 1 hour. What is its estimated availability?
مكوّن قيمة MTBF له 999 ساعة وMTTR ساعة واحدة. ما توافريته المقدّرة؟
A. A = MTBF / (MTBF + MTTR) = 999 / 1000 = 0.999. D is the unavailability (1 − A), not the availability.
الجواب A. A = MTBF / (MTBF + MTTR) = 999 / 1000 = 0.999. الخيار D هو عدم التوافر (1 − A)، وليس التوافر.
A provider refunds 10% of the monthly bill if uptime falls below 99.99%. In SLI / SLO / SLA terms, what makes this an SLA?
مزوّد يعيد 10% من الفاتورة الشهرية إذا نزلت التوافرية عن 99.99%. بمصطلحات SLI / SLO / SLA، ما الذي يجعل هذا SLA؟
C. An SLA is a contract with consequences for missing its objectives. A describes the SLI (the measurement). B describes an SLO (an internal target). D is not a definition: an SLA can be looser or stricter than internal SLOs.
الجواب C. الـ SLA عقد له عواقب عند تفويت أهدافه. الخيار A يصف SLI (القياس). والخيار B يصف SLO (هدف داخلي). والخيار D ليس تعريفاً، فقد تكون SLA أكثر تساهلاً أو أشد من الأهداف الداخلية.