ورا الترند مع فهرسجي

كيف يُسقط خطأ صغير خدمة يستخدمها الملايين؟

أحياناً يكفي تحديث واحد، أو ضغطة زر.

هندسة موثوقية المواقع، جوجل، 2016 · مايكروسوفت، 2024

الجواب

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

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

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

ثالثاً، الانهيار المتتالي. حين يسقط الجزء المتعب، ينتقل عمله إلى جيرانه، فيتعبون بدورهم ويسقطون. ويسمّي المهندسون هذا انهياراً متتالياً، أي فشلاً يكبر من نفسه.

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

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

المصدر

هندسة موثوقية المواقع، جوجل، 2016 · مايكروسوفت، 2024

  • Google, «Site Reliability Engineering» (O'Reilly, 2016), chapter 22 «Addressing Cascading Failures»: «A cascading failure is a failure that grows over time as a result of positive feedback»; retries add to the load («100 QPS of retries in the first second leads to 200 QPS, then to 300 QPS»); with three retries per layer over three layers, one user action can create «64 attempts (4^3) on the database»; the load of a failed part moves to the others, https://sre.google/sre-book/addressing-cascading-failures/
  • Google, «The Site Reliability Workbook» (O'Reilly, 2018), chapter 16 «Canarying Releases»: «The term canarying refers to the practice of bringing canaries into coal mines to determine if the mine is safe for humans»; canarying is «a partial and time-limited deployment of a change in a service and its evaluation», https://sre.google/workbook/canarying-releases/
  • Microsoft, «Helping our customers through the CrowdStrike outage» (20 Jul 2024): «CrowdStrike's update affected 8.5 million Windows devices, or less than one percent of all Windows machines», https://blogs.microsoft.com/blog/2024/07/20/helping-our-customers-through-the-crowdstrike-outage/
  • Microsoft Learn, Azure Architecture Center, «Bulkhead pattern»: «named after the sectioned partitions (bulkheads) of a ship's hull. If the hull of a ship is compromised, only the damaged section fills with water», https://learn.microsoft.com/en-us/azure/architecture/patterns/bulkhead