Nagesh Kumar Siddu
Nagesh Kumar Siddu
  • 34
  • 891
BASE and 2 Phase Commit
BASE, Two Phase Commit and Saga
Let us assume our application has 3 microservices.
1. Order Service: Manages orders placed by customers.
2. Inventory Service: Manages product stock levels.
3. Payment Service: Handles payment processing.
Introduction to BASE
Distributed systems often adopt the BASE principle over strict consistency for scalability and availability:
• Basically Available: Guarantees that the system remains available for most operations, even under failure conditions.
• Soft state: The state of the system may change over time, even without external input (due to eventual consistency).
• Eventual consistency: Guarantees that the system will become consistent eventually, as updates propagate.
Example: When a user places an order, services work asynchronously to ensure stock is deducted, payment is processed, and the user is notified. The consistency of all services is eventually achieved.
Handling transactions
1) 2 PC and 2) Saga
1. Two-Phase Commit (2PC)
2PC ensures atomic consistency across distributed services by coordinating operations in two phases: Prepare and Commit/Abort.
How It Works:
1. Prepare Phase:
o A coordinator service initiates the transaction and asks all participating services (e.g., Order, Inventory, Payment) to "prepare" for the operation.
o Each service checks if it can perform the operation (e.g., sufficient stock or payment approval) and locks the necessary resources.
o Services respond to the coordinator with a yes (prepared) or no (abort).
2. Commit Phase:
o If all services respond with yes, the coordinator sends a commit message to all participants, finalizing the transaction.
o If any service responds with no, the coordinator sends an abort message to roll back any partial changes.
Example:
1. The user places an order.
2. The coordinator sends a prepare request:
o Order Service reserves the order.
o Inventory Service locks stock.
o Payment Service holds the payment amount.
3. If all services respond with "prepared," the coordinator sends a commit:
o The order is finalized, stock is deducted, and payment is captured.
4. If any service fails, the coordinator sends an abort, rolling back all changes (e.g., releasing stock and refunding payment).
Challenges with 2PC:
• Performance overhead: Locks held during the prepare phase can slow down the system.
• Single point of failure: The coordinator is critical and can become a bottleneck.
• Not resilient to partial system failures or partitions.
#microservices #cloudnative
มุมมอง: 8

วีดีโอ

Saga Orchestration and Choreography
มุมมอง 74 ชั่วโมงที่ผ่านมา
Saga Pattern The Saga pattern offers a more scalable alternative to 2PC by breaking a transaction into a series of smaller, independent steps with associated compensating actions (for rollback). It ensures eventual consistency. How It Works: 1. Orchestration Saga (Coordinator-Based): 2. Choreography Saga (Event-Based): Orchestration Saga (Coordinator-Based): A central saga orchestrator coordina...
CAP Theorem
มุมมอง 164 ชั่วโมงที่ผ่านมา
CAP Theorem The CAP theorem (also known as Brewer's theorem) is a fundamental principle in distributed systems, particularly relevant to microservices. It states that in a distributed system, it is impossible to simultaneously guarantee all three of the following: 1. Consistency (C): Every read receives the most recent write or an error. 2. Availability (A): Every request (read or write) receiv...
TLS and mTLS
มุมมอง 104 ชั่วโมงที่ผ่านมา
TLS and mTLS TLS TLS (Transport Layer Security) is a protocol that secures data when it’s being sent over the internet, preventing others from reading or tampering with it. How TLS Works (in Simple Terms) Imagine you’re sending a letter to a friend across the country. If you don’t secure the letter, anyone who intercepts it could read it. TLS is like sealing the letter in a special locked box. ...
Securing Microservices- 12 Best Practices
มุมมอง 84 ชั่วโมงที่ผ่านมา
Microservices Security The microservices architecture expands the attack surface with multiple microservices communicating with each other remotely. There are multiple perspectives in securing microservices: 1. secure development lifecycle 2. test automation 3. security in DevOps 4. application-level security 1. API Gateway • Centralized entry point: An API Gateway serves as a single entry poin...
Observability - Logging, Metrics, Tracing
มุมมอง 48วันที่ผ่านมา
Observability Observability is the measure of how well internal states of a system can be inferred from knowledge of its external outputs. We need to track the throughput of each microservice, the number of success/failed requests, utilization of CPU, memory and other network resources, and some business-related metrics It should be incorporated into the microservices architecture & design. Obs...
Containerization
มุมมอง 621 วันที่ผ่านมา
Containerization A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings. C...
Containers Vs Virtual Machines
มุมมอง 1721 วันที่ผ่านมา
Containers versus virtual machines (VMs) A VM is an entire operating system with its own kernel, hardware drivers, programs, and applications. A container is simply an isolated process with all of the files it needs to run. If you run multiple containers, they all share the same kernel, allowing you to run more applications on less infrastructure. #cloudnative #microservicesarchitecture
Service Mesh introduction
มุมมอง 621 วันที่ผ่านมา
Service mesh Service mesh is an infrastructure layer used to manage service-to-service traffic through the capabilities provided by a set of sidecar proxies. It solves the traffic management challenges for microservice applications and manages service communication. Let us take an example Service A was expecting a response from Service B through an API call. Service B may be down or facing a he...
Declarative API
มุมมอง 421 วันที่ผ่านมา
Declarative API 1. A declarative is a process where we describe a desired outcome and then the system internally implements the functionality to satisfy that desired outcome. 2. Imperative process, which tells the system how to do something, and declarative, which tells the system what to do. 3. The declarative API is an important capability of Kubernetes, and the declarative configuration allo...
Service Governance
มุมมอง 1421 วันที่ผ่านมา
Service Governance Microservices need to be governed to manage them successfully. For example, 1. Services do not know each other so they need functionality for service registration and service discovery 2. Services are independent and hence anomalies related to service performance or invocation need to be observed 3. When services are overloaded with requests, they need traffic management Thes...
Microservices Vs Cloud Native
มุมมอง 421 วันที่ผ่านมา
Microservices Vs Cloud Native
Tradeoffs in distributed systems
มุมมอง 1421 วันที่ผ่านมา
Tradeoffs in distributed systems
Microservices trade offs
มุมมอง 1221 วันที่ผ่านมา
Microservices trade offs
Characteristics of microservices application
มุมมอง 1221 วันที่ผ่านมา
Characteristics of microservices application
What is micro services architecture
มุมมอง 5021 วันที่ผ่านมา
What is micro services architecture
5 tips to transform a dysfunctional team to amazing work culture
มุมมอง 23ปีที่แล้ว
5 tips to transform a dysfunctional team to amazing work culture
6 Effective Tips for Leading with Authenticity
มุมมอง 24ปีที่แล้ว
6 Effective Tips for Leading with Authenticity
CBRZPH School Centenary Celebrations 2020 - Invitation by GNB Acharyulu garu of 1967 Batch
มุมมอง 4915 ปีที่แล้ว
CBRZPH School Centenary Celebrations 2020 - Invitation by GNB Acharyulu garu of 1967 Batch

ความคิดเห็น

  • @JolieJapport
    @JolieJapport 2 วันที่ผ่านมา

    I really appreciate your efforts! I have a quick question: I have a SafePal wallet with USDT, and I have the seed phrase. (alarm fetch churn bridge exercise tape speak race clerk couch crater letter). Could you explain how to move them to Binance?

  • @Shruti68-b9j
    @Shruti68-b9j 2 วันที่ผ่านมา

    Good one

  • @Shruti68-b9j
    @Shruti68-b9j 2 วันที่ผ่านมา

    1. Timestamps 2. Legibility in notes and explanation through mindmaps 3. Summarisation 4. Practical scenarios and usecases 5. Illustrations

  • @Shruti68-b9j
    @Shruti68-b9j 23 วันที่ผ่านมา

    Good to listen to you after a long time nagesh. Looking forward for more transforming content

  • @Shruti68-b9j
    @Shruti68-b9j 23 วันที่ผ่านมา

    Well explained with practical leadership focus. Would like to see more leadership lessons from you.

    • @nageshsiddu
      @nageshsiddu วันที่ผ่านมา

      Thank you Shruti

  • @mohanajavvaji3398
    @mohanajavvaji3398 2 ปีที่แล้ว

    Good

  • @tempernagagowdntr3382
    @tempernagagowdntr3382 5 ปีที่แล้ว

    Super