ในระบบหนึ่ง คอมโพเนนต์ต่าง ๆ (services, clients) สื่อสารกันผ่าน APIs และโปรโตคอลต่าง ๆ — แบบ synchronous (REST, gRPC) และ asynchronous (messaging/queues) การเข้าใจว่าคอมโพเนนต์สื่อสารกันอย่างไรเป็นพื้นฐานของการออกแบบระบบที่ประกอบด้วยหลายส่วน
การสื่อสารแบบ synchronous (request/response)
The caller WAITS for a response (blocking):
REST (HTTP) → most common; resources over HTTP (JSON) → simple, ubiquitous, web-friendly
gRPC → high-performance RPC (binary, HTTP/2) → fast, typed; good for internal services
GraphQL → flexible queries (client requests exactly what it needs)
→ for: direct request/response where the caller needs an answer now
