Nâng CaoNode.js iconNode.js

Microservices communication patterns?

Microservices giao tiếp với nhau qua hai cách chính: synchronous và asynchronous. Synchronous dùng REST (đơn giản, phổ biến) hoặc gRPC (nhanh hơn nhờ Protocol Buffers và HTTP/2, type-safe, phù hợp internal services). Asynchronous dùng message queue như RabbitMQ cho task queue đơn giản, Redis pub/sub cho real-time events, hoặc Kafka cho high-throughput event streaming.

Pattern API Gateway đặt ở trước làm single entry point, xử lý routing, authentication, và rate limiting tập trung thay vì mỗi service tự làm.

Circuit breaker pattern rất quan trọng: khi một service lỗi, tạm ngắt kết nối đến service đó thay vì tiếp tục gửi requests gây cascade failure — thư viện opossum cho Node.js hỗ trợ pattern này.

Xem toàn bộ Node.js cùng filter theo level & chủ đề con.

Mở danh sách Node.js