Production Engineering / PRODUCTION READINESS & SERVICE OWNERSHIP / PRD-002

Health Contract

Explore concept graph

Latihan soal

Local HTTP proof: status state machine

Jalankan fixture Node 24:

node generation/fixtures/PRD-002/health-contract.mjs

Prediksi output berikut sebelum menjalankan:

boot-live=200
boot-ready=503
warm-ready=200
db-down-live=200
db-down-ready=503
db-recover-ready=200
drain-live=200
drain-ready=503

Ini adalah HTTP simulation, bukan database sungguhan, Spring Boot atau Kubernetes. Fixture hanya membuktikan status yang keluar dari boolean warmup, DB dan drain; tidak membuktikan Pod restart, Service traffic routing atau graceful completion.

Konsep 1 / 3

Define /live and /ready as different Spring Boot health contracts.

Coba prediksi atau perbaiki

DB down but server responsive: which probe can fail without immediately restarting the container?

Kalau jawabanmu berbeda

Kesalahan yang mungkin: Putting DB health in /live.

Mengapa tidak bekerja: An outage triggers synchronized restarts that cannot fix a shared dependency.

Coba perbaiki: Restrict liveness to process health and scope readiness checks to truly critical dependencies.

Periksa hasil sendiri

Hasil yang diharapkan: During modeled DB outage, /live remains 200 but /ready becomes 503.

Kalau berbeda: Inspect health group membership and distinguish process failure from downstream failure.

Konsep 2 / 3

Separate a startupProbe budget from readiness during warming.

Coba prediksi atau perbaiki

HTTP listener is alive during a lengthy cache warmup. Must /live remain 503?

Kalau jawabanmu berbeda

Kesalahan yang mungkin: Treating liveness 200 as proof that all business initialization is complete.

Mengapa tidak bekerja: Startup and readiness control different lifecycle decisions.

Coba perbaiki: Keep readiness unavailable until required initialization actually finishes.

Periksa hasil sendiri

Hasil yang diharapkan: Fixture boot-live=200, boot-ready=503 and warm-ready=200.

Kalau berbeda: Verify the real startup phase and which endpoint the startup probe checks.

Konsep 3 / 3

Simulate DB outage and graceful shutdown without dependency-driven restart loops.

Coba prediksi atau perbaiki

Does failing readiness on all replicas require Kubernetes to restart all of them?

Kalau jawabanmu berbeda

Kesalahan yang mungkin: Assuming process alive proves that a transfer is safe, or treating readiness failure as process death.

Mengapa tidak bekerja: Health does not prove authorization, idempotency, or ledger consistency; readiness does not by itself restart a process.

Coba perbaiki: Retain business-level checks and separate the health groups' failure domains.

Periksa hasil sendiri

Hasil yang diharapkan: Local fixture returns ready=503 during DB down and drain, ready=200 on recovery, live=200 throughout. In a real Spring Boot shutdown, the probe endpoint might not accept new HTTP connections; do not expect an always-observable 503.

Kalau berbeda: Separate simulated booleans from actual DB, Spring and Kubernetes state observations.

Lima soal health contract

Jawab tanpa melihat pembahasan dulu. Kamu bisa memperbaiki jawaban dan mencoba lagi. Kuis ini latihan mandiri dan tidak menyimpan skor atau progres.

Transfer DB gagal, tetapi proses masih sehat. Sinyal mana tepat?
Untuk apa startupProbe pada aplikasi cold start lama?
Konfigurasi Spring Boot untuk alias /ready pada port aplikasi utama?
Apakah Actuator readiness otomatis memasukkan semua cek external DB?
Saat Spring Boot graceful shutdown, apa yang harus dibuktikan tentang readiness dan probe HTTP?