From the course: DevOps Foundations: Microservices
Unlock the full course today
Join today to access over 24,600 courses taught by industry experts.
Synchronous calling patterns
From the course: DevOps Foundations: Microservices
Synchronous calling patterns
When a microservice or any other program makes a synchronous network request to another service, the calling thread blocks and waits for a response. This has design implications for performance and scale. Generally speaking, calls from microservices to other resources should be asynchronous when they can be. However, there are scenarios where synchronous calls are required. Let's review some of the pros and cons of synchronous calling patterns. Then we'll talk about when synchronous patterns are most appropriate. Synchronous calls have several upsides. Synchronous code is simple and easy to write and understand. Synchronous calls either succeed or fail completely in a predetermined time frame, usually defined by a timeout. In cases where the order of calls is important, synchronous calling can be used to ensure that calls are executed in a deterministic order. On the challenges side, synchronous calls don't scale well because they wait for completion before returning control. This…