❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayMain stream

Learning Notes #36 – Active Active / Active Passive Patterns | HA Patterns

4 January 2025 at 18:04

Today, i learnt about High Availability patterns. Basically on how to handle the clusters for high availability. In this blog i jot down notes on Active Active and Active Passive Patterns for better understanding.

Active-Active Configuration

In an Active-Active setup, all nodes in the cluster are actively processing requests. This configuration maximizes resource utilization and ensures high throughput. If one node fails, the remaining active nodes take over the load.

Example Scenario

Consider a web application with two servers:

  1. Server 1: IP 192.168.1.10
  2. Server 2: IP 192.168.1.11
  3. Server 3: IP 192.168.1.12
  4. Server 4: IP 192.168.1.13

Both servers handle incoming requests simultaneously. A load balancer distributes traffic between these servers to balance the load.

Pros and Cons

Pros:

  • Higher resource utilization.
  • Better scalability and performance.

Cons:

  • Increased complexity in handling data consistency and synchronization.
  • Potential for split-brain issues in certain setups.

Sample HAProxy config


frontend http_front
    bind *:80
    default_backend http_back

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

backend http_back
    balance roundrobin
    server server_a 192.168.1.10:80 check
    server server_b 192.168.1.11:80 check

Active-Passive Configuration

In an Active-Passive setup, one node (Active) handles all the requests, while the other node (Passive) acts as a standby. If the active node fails, the passive node takes over.

Example Scenario

Using the same servers:

  1. Server 1: IP 192.168.1.10 (Active)
  2. Server 2: IP 192.168.1.11 (Active)
  3. Server 3: IP 192.168.1.12 (Passive)
  4. Server 4: IP 192.168.1.13 (Passive)

Server B remains idle until Server A becomes unavailable, at which point Server B assumes the active role.

Pros and Cons

Pros:

  • Simplified consistency management.
  • Reliable failover mechanism.

Cons:

  • Underutilized resources (passive node is idle most of the time).
  • Slight delay during failover.

Sample HA Proxy Config


frontend http_front
    bind *:80
    default_backend http_back

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

backend http_back
    server server_a 192.168.1.10:80 check
    server server_b 192.168.1.11:80 check backup

❌
❌