Cloud distributed

Commander
Intent Used to handle all problems that can be encountered when doing distributed transactions. Class diagram Applicability This pattern can be used when we need to make commits into 2 (or more) databases to complete transaction, which cannot be done atomically and can thereby create problems. Explanation Handling distributed transactions can be tricky, but if we choose to not handle it carefully, there could be unwanted consequences. Say, we have an e-commerce website which has a Payment microservice and a Shipping microservice.
Leader Election
Intent Leader Election pattern is commonly used in cloud system design. It can help to ensure that task instances select the leader instance correctly and do not conflict with each other, cause contention for shared resources, or inadvertently interfere with the work that other task instances are performing. Class diagram Applicability Use this pattern when the tasks in a distributed application, such as a cloud-hosted solution, require careful coordination and there is no natural leader.
Poison Pill
Intent Poison Pill is known predefined data item that allows to provide graceful shutdown for separate distributed consumption process. Explanation Real world example Let’s think about a message queue with one producer and one consumer. The producer keeps pushing new messages in the queue and the consumer keeps reading them. Finally when it’s time to gracefully shut down the producer sends the poison pill message. In plain words Poison Pill is a known message structure that ends the message exchange.
Priority Queue Pattern
Intent Prioritize requests sent to services so that requests with a higher priority are received and processed more quickly than those of a lower priority. This pattern is useful in applications that offer different service level guarantees to individual clients. Explanation Applications may delegate specific tasks to other services; for example, to perform background processing or to integrate with other applications or services. In the cloud, a message queue is typically used to delegate tasks to background processing.
Queue based load leveling
Intent Use a queue that acts as a buffer between a task and a service that it invokes in order to smooth intermittent heavy loads that may otherwise cause the service to fail or the task to time out. This pattern can help to minimize the impact of peaks in demand on availability and responsiveness for both the task and the service. Class diagram Applicability This pattern is ideally suited to any type of application that uses services that may be subject to overloading.
Saga
Also known as This pattern has a similar goal with two-phase commit (XA transaction) Intent This pattern is used in distributed services to perform a group of operations atomically. This is an analog of transaction in a database but in terms of microservices architecture this is executed in a distributed environment Explanation A saga is a sequence of local transactions in a certain context. If one transaction fails for some reason, the saga executes compensating transactions(rollbacks) to undo the impact of the preceding transactions.
Throttling
Intent Ensure that a given client is not able to access service resources more than the assigned limit. Explanation Real-world example A young human and an old dwarf walk into a bar. They start ordering beers from the bartender. The bartender immediately sees that the young human shouldn’t consume too many drinks too fast and refuses to serve if enough time has not passed. For the old dwarf, the serving rate can be higher.
Strangler
Intent Incrementally migrate a legacy system by gradually replacing specific pieces of functionality with new applications and services. As features from the legacy system are replaced, the new system eventually covers all the old system’s features and may has its own new features, then strangling the old system and allowing you to decommission it. Class diagram Applicability This strangler pattern is a safe way to phase one thing out for something better, cheaper, or more expandable.