You are already a distributed system developer
published on 2022/10/17
Here are some common distributed systems patterns you may have encountered:
- Replicated Load-Balanced Services (RLBS), or Load Balancing, where you have duplicate services, and you use a load balancer to send requests to those services. This is one of the first distributed systems patterns many developers encounter because it's a common way to handle heavy traffic. For example, a company may deploy a web application to 10 servers worldwide, and load balancers route traffic to servers based on traffic, geography, or resource usage.
- Two-Phase Commit, which is a pattern used to consistently update multiple data sources. In a two-phase commit, each data source is a node in a cluster. You first prepare all the nodes to receive the update, using one of the nodes to coordinate the transaction. Each node lets the coordinator know it's ready and available to receive and process the commit. Once every node is ready, you execute the transaction on all the nodes. Two-Phase Commit is a good strategy when you're concerned with the integrity of the data rather than resource usage.
- Saga, where you have a series of local transactions and an event bus. Each local transaction sends a message or event to the event bus, which hands the process off to the next transaction. If a transaction fails, you execute a different set of transactions to roll things back. A corporate travel site where a customer can book a flight and a hotel at the same time might use the Saga pattern. If a customer reserves a flight but then decides to cancel because there are no available hotels, you'll need to cancel their flight reservation, which means rolling back the transaction for the flight.
We are investigating on adopting Temporal in our technology stack at the moment.
- Software Engineering