Skip to main content

Microservices

 Microservice is a small, loosely coupled service that is designed to perform a specific business function and each microservice can be developed, deployed, and scaled independently



How to manage high availability of the system:

    horizontal scaling, load balancing, service discovery, and automated restarts, allowing applications to continue running even if individual components fail. 

  1. Redundancy and Replication: 

Multiple Instances:
Deploy multiple instances of each microservice to ensure that if one instance fails, others can take over the load

Replication:
  • Replicate data across multiple databases or storage systems to prevent data loss and ensure availability. 
    2. Load Balancing:
  • Distribute Traffic:
    Use load balancers to distribute incoming traffic across multiple instances of a microservice, preventing any single instance from being overloaded
  • 3. Auto-Scaling
  • Dynamic Scaling:
  • Implement auto-scaling to automatically add or remove instances of a microservice based on the current load.
  • Horizontal Scaling: - automatically scale out applications by creating more instances (pods) of a workload, ensuring that if one pod fails, others are available to handle traffic

  • Service Discovery:

  • 4. Failover and Fault Tolerance:
    • Failover Mechanisms:
      Implement failover mechanisms that automatically redirect traffic to healthy instances when a service or instance fails. 

      • Queues:
        Use queues to decouple services and handle spikes in traffic, preventing overloads. 

Comments

Popular posts from this blog

API Basics

 

Algorithm solving Common Patterns & Techniques

  These are targeted data manipulation strategies used to handle arrays, strings, and linked lists efficiently. Two Pointers : Uses two reference pointers to iterate through a data structure simultaneously, typically from opposite ends or at different speeds (Fast & Slow pointers). Sliding Window : Maintains a subset of data (a "window") over a sequential structure to track running statistics without recalculating the whole set. Prefix Sum : Pre-computes and stores cumulative sums of an array to allow for \(O(1)\) constant-time range sum queries. Dynamic Programming (DP ): Dynamic programming is an optimization technique used to solve problems by breaking them down into simpler subproblems and storing the results of these subproblems to avoid redundant computations. It is particularly effective for problems exhibiting overlapping subproblems and optimal substructure. Greedy Algorithm Breadth-First Search (BFS) / Depth-First Search (DFS) : Systematic graph and tree travers...