تمرین ۱ — محاسبهٔ بارExercise 1 — load math
روز آموزشی ۸۶۴۰۰ ثانیه و ضریب اوج ۱۰ است؛ هر سفارش سه پیام اعلان میسازد. کش، یک سطر خلاصهٔ سفارش با کلید order_id در k مقصد منطقی است؛ k را جدا از سه سرویس تعیین کن.A teaching day has 86400 seconds and the peak factor is 10; each order emits three notifications. The cache stores an order-summary row keyed by order_id in k logical destinations; k is independent of the three services.
نسخهٔ بازبینیشده برای مصاحبهReviewed interview brief
برای دو میلیون سفارش در روز و اوج دهبرابری، RPS و تعداد سه پیام داخلی بهازای هر سفارش را حساب کن. سپس یک view مشخص تعریف کن که هر سفارش در k مقصد آن نوشته میشود؛ write amplification، نرخ خواندن، اندازهٔ payload و lag را مقایسه کن و دربارهٔ materialization تصمیم بگیر.Calculate average and peak orders/s and three internal notifications per order. Define a materialized view with k destinations, then compare extra writes, read savings, payload size and freshness.
معیار پاسخ خوبWhat a good answer demonstrates
- ۲۳٫۱۵ و ۲۳۱٫۵ سفارش در ثانیه را درست محاسبه میکندCorrect average/peak math
- سه پیام را با k نوشتن کش یکی نمیگیردNotification versus view fan-out
- فرضها و نقطهٔ سربهسر را بیان میکندExplicit break-even assumptions
پیگیری مصاحبه:Interview follow-up: اگر یک مشتری بزرگ k را صد برابر کند چه اتفاقی برای tail latency میافتد؟What happens to tail latency when one large customer increases k by a factor of 100?
آزمایشگاه تکمیلی · زمان تقریبی ۳۰–۶۰ دقیقهExtended hands-on laboratory · estimated 30–60 minutes
روزانه ۲ میلیون سفارش و سه اعلان به سرویسهای موجودی، ریسک و اطلاعرسانی داریم. با فرض آموزشی اوج دهبرابری، سفارش و پیام بر ثانیه را جدا حساب کن. برای کش، یک سطر خلاصهٔ سفارش در k مقصد منطقی تعریف کن؛ ابتدا k=1 و سپس k=5 را بسنج. هر تغییر سفارش در هر مقصد یک upsert دارد؛ تکثیر فیزیکی ذخیرهساز را جدا بشمار. نرخ خواندن Q، هزینهٔ خواندن مرجع C_db، هزینهٔ خواندن کش C_cache و هزینهٔ نگهداری هر نوشتن C_w را با واحد سازگار تعریف کن. شرط Q×(C_db−C_cache) > λ_order×k×C_w را از مقایسهٔ هزینهها به دست بیاور؛ اندازهٔ payload، ترافیک و lag مجاز را هم بسنج. توضیح بده چرا سه اعلان لزوماً سه نوشتن کش نیست.
Assume 2M orders/day, three internal notifications per order and a teaching peak factor of ten. Calculate orders/s and messages/s separately. Define a cache containing one order-summary row in k logical destinations; compare k=1 and k=5, with one upsert per destination per order change. Count physical storage replication separately. Define read rate Q, source-read cost C_db, cache-read cost C_cache and per-write maintenance cost C_w in compatible units. Derive Q×(C_db−C_cache) > λ_order×k×C_w by comparing saved read cost with added write cost. Include payload, bandwidth and allowed lag; explain why three notifications do not imply three cache writes.
برای یادگیریِ عمیق است؛ انجام کاملش در زمان بحثِ مصاحبه انتظار نمیرود.The full laboratory is optional depth work and is not expected within the discussion time.
ارزیابی، سطح و شواهد این تمرینAssessment, level and evidence · حل آموزشی این تمرینWorked solution · Amazon · SDE III interview preparation · Google SRE · implementing SLOs