Service Discovery

Cách hiểu bằng lời của tôi

Service Discovery là cách service tìm network location hiện tại của service khác trong môi trường instance thay đổi liên tục. Thay vì hard-code host/port, hệ thống dùng registry, DNS hoặc control plane để biết instance nào đang khỏe.

Cơ chế

Service instance start
-> đăng ký endpoint và health vào registry
-> client/gateway/load balancer tra registry
-> route request tới instance khỏe
-> instance unhealthy bị rút khỏi pool

Khi áp dụng

Nó đặc biệt quan trọng với microservices, autoscaling, container orchestration và multi-region deployment, nơi instance có thể xuất hiện/biến mất thường xuyên.

Liên kết