loading image
Back to glossary

BASE (Basically Available, Soft state, Eventually consistent)

Data consistency model prioritizing availability and partition tolerance over immediate consistency in distributed systems.

Updated on January 25, 2026

BASE is a consistency model for distributed systems that contrasts with ACID by prioritizing availability over strict consistency. Designed for large-scale architectures, BASE accepts that data may be temporarily inconsistent across nodes, guaranteeing eventual convergence to a consistent state. This approach addresses CAP theorem constraints by choosing Availability and Partition tolerance over strong Consistency.

Fundamentals of the BASE Model

  • Basically Available: the system guarantees data availability even during partial failures, potentially returning stale data
  • Soft state: system state can change without external input due to asynchronous propagation of updates between nodes
  • Eventually consistent: the system converges to consistency after a delay, without guaranteeing immediate consistency after writes
  • Optimization for horizontal scalability and distributed read/write performance

Benefits of the BASE Model

  • High availability: operations continue even during node failures or network partitions
  • Horizontal scalability: easy addition of nodes without impacting overall performance
  • Reduced latency: writes don't require synchronous consensus across all nodes
  • Enhanced resilience: fault tolerance without complete service interruption
  • Optimal performance for large-scale distributed systems (millions of users, billions of transactions)

Practical Implementation Example

An e-commerce recommendation system perfectly illustrates BASE. When a user purchases a product, this information must propagate to multiple services: inventory, recommendations, analytics. With BASE, the purchase is confirmed immediately (availability), but recommendations may take a few seconds to update (eventual consistency).

base-event-system.ts
// BASE event system with eventual consistency
interface PurchaseEvent {
  userId: string;
  productId: string;
  timestamp: number;
  version: number;
}

class BASEEventStore {
  private eventLog: PurchaseEvent[] = [];
  private replicas: Map<string, PurchaseEvent[]> = new Map();

  // Write immediately available (Basically Available)
  async recordPurchase(event: PurchaseEvent): Promise<void> {
    // Local write without waiting for replicas
    this.eventLog.push(event);
    
    // Asynchronous propagation (Eventually Consistent)
    this.propagateToReplicas(event).catch(err => {
      console.log('Propagation delayed, retry scheduled');
      this.scheduleRetry(event);
    });
  }

  // Asynchronous propagation to replicas
  private async propagateToReplicas(event: PurchaseEvent): Promise<void> {
    const replicaPromises = Array.from(this.replicas.keys()).map(replicaId => 
      this.sendToReplica(replicaId, event)
        .catch(() => ({ replicaId, success: false }))
    );
    
    // Don't wait for all replicas (Soft State)
    await Promise.race([...replicaPromises, this.timeout(100)]);
  }

  // Read with version detection (conflict resolution)
  async getUserPurchases(userId: string): Promise<PurchaseEvent[]> {
    const localEvents = this.eventLog.filter(e => e.userId === userId);
    
    // Reconciliation with replicas if available
    const replicaEvents = await this.fetchFromReplicas(userId);
    
    return this.mergeWithVersioning(localEvents, replicaEvents);
  }

  // Conflict resolution through versioning (Eventually Consistent)
  private mergeWithVersioning(
    local: PurchaseEvent[], 
    remote: PurchaseEvent[]
  ): PurchaseEvent[] {
    const merged = new Map<string, PurchaseEvent>();
    
    [...local, ...remote].forEach(event => {
      const key = `${event.userId}-${event.productId}`;
      const existing = merged.get(key);
      
      // Take the most recent version
      if (!existing || event.version > existing.version) {
        merged.set(key, event);
      }
    });
    
    return Array.from(merged.values());
  }

  private timeout(ms: number): Promise<void> {
    return new Promise(resolve => setTimeout(resolve, ms));
  }

  private async sendToReplica(replicaId: string, event: PurchaseEvent): Promise<void> {
    // Network send simulation
    await this.timeout(Math.random() * 50);
  }

  private async fetchFromReplicas(userId: string): Promise<PurchaseEvent[]> {
    return [];
  }

  private scheduleRetry(event: PurchaseEvent): void {
    setTimeout(() => this.propagateToReplicas(event), 5000);
  }
}

Implementing a BASE Architecture

  1. Identify use cases tolerant to eventual consistency (social networks, analytics, recommendations)
  2. Choose a BASE-compatible database (Cassandra, DynamoDB, Riak, MongoDB with replication)
  3. Implement a versioning or timestamping system for conflict resolution
  4. Set up event sourcing or event logging for traceability
  5. Configure consistency levels per operation (adjustable read/write quorum)
  6. Develop compensation mechanisms to handle temporary inconsistencies
  7. Monitor convergence delays and adjust replication parameters

Practical Advice

Don't blindly apply BASE to your entire system. Combine ACID for critical transactions (payments, inventory) and BASE for high-volume data tolerant to temporary inconsistency (likes, views, recommendations). This hybrid approach optimizes both business consistency and performance.

Associated Technologies and Tools

  • Apache Cassandra: distributed NoSQL database with configurable consistency (eventual consistency by default)
  • Amazon DynamoDB: managed key-value database with eventual and strong consistency options
  • Riak: distributed database designed for high availability with conflict resolution
  • CouchDB: document database with multi-master replication and eventual consistency
  • Redis Cluster: distributed cache with asynchronous replication
  • Event Store: event storage for event sourcing with BASE guarantees
  • Kafka: streaming platform for asynchronous event propagation between services

BASE represents an essential architectural trade-off for modern large-scale systems. By accepting eventual consistency, companies can build platforms capable of serving millions of simultaneous users with 99.99% availability. The challenge lies in properly identifying where to apply BASE (non-critical features, analytics, caches) versus ACID (financial transactions, inventory), thus optimizing both infrastructure costs and user experience.

Themoneyisalreadyonthetable.

In 1 hour, discover exactly how much you're losing and how to recover it.

Web development, automation & AI agency

contact@peaklab.fr
Newsletter

Get our tech and business tips delivered straight to your inbox.

Follow us

© PeakLab 2025