انتقل إلى المحتوى
أمين أبوزيد
درس مخطط لهMID-040-L01

الاندفاعات (Stampedes)

  • الدرس 1 من 5
  • Mid-level
في هذا الدرس 4 موضوعات

هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

في هذا الدرس

explain a cache stampede and the three standard defences.

الموضوعات المخطط لها

  • A stampede: a hot key expires and many requests miss at once, all hitting the database for the same row.
  • Locking: only one request rebuilds; the others wait or serve the old value.
  • Request coalescing (single flight): concurrent loads of one key share one call (Caffeine LoadingCache does this per instance).
  • Early refresh: refresh before expiry (refreshAfterWrite) or add random jitter to TTLs.
  • Per-instance coalescing still allows one load per instance; use a distributed lock for stronger protection.
تفاصيل المخطط المبدئي

عرض عملي

timeline: 500 requests at 12:00:00 when product:7 expires; with a lock, 1 database query instead of 500.

اختبر فهمك

Name two ways to avoid a stampede.

أظهر الإجابة

Locking/coalescing, early refresh, TTL jitter.

التطبيق

طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.

المختبر والتمارين الاختبار

تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.