SupaScale 12-Container Supabase Docker Workbench Emblem SupaScale 12-Container Docker
  • 12-Container Workbench
  • Blueprints (8)
  • Comparisons (4)
  • Methodology
  • About
  • Contact
  • VI // TIẾNG VIỆT
    BP-04 // REALTIME ELIXIR & WAL CDC // SUPASCALE BLUEPRINT

    Supabase Realtime WebSockets: 10K+ Socket BEAM Tuning — SupaScale Docker Guide

    Managed Supabase Pro includes 500 peak WebSockets before metering extra connections and messages. SupaScale models how Elixir BEAM scales past 10,000 sockets on 16 GB NVMe.

    SupaScale minimum floor: 8 GB RAM • Sweet-spot tier: 16 GB RAM (Public vendor rates retrieved 2026-11-12).

    SupaScale Deterministic OOM Risk Analysis:

    Subscribing thousands of clients to postgres_changes (WAL CDC) on RLS-protected tables forces PostgreSQL to execute an RLS permission check per subscriber on every INSERT—saturating vCPU cores rapidly!

    SupaScale Supabase Realtime WebSockets: 10K+ Socket BEAM Tuning Self-Hosted Supabase Docker Architecture Diagram
    SupaScale deterministic container topology for Supabase Realtime WebSockets: 10K+ Socket BEAM Tuning.

    SupaScale Deterministic Memory Model Table: Supabase Realtime WebSockets: 10K+ Socket BEAM Tuning

    Supabase Docker Subsystem Baseline Idle Reserve 50K MAU Projected Reserve Memory Role
    Broadcast Ephemeral Channels (No Per-Row RLS) 390 MB 1.15 GB @ 10K sockets Linear BEAM Scale
    Presence Shared CRDT Room State 420 MB 1.55 GB @ 10K sockets Higher BEAM Heap
    Postgres Changes (Single-Slot WAL CDC) 450 MB CPU-bound >1.5K subs Prefer Broadcast
    Supabase Cloud 10K Peak + 80M Messages $25 Pro ~$315/mo metered Flat KVM Wins

    SupaScale Realtime Elixir BEAM & Linux Kernel Socket Limits

    # /etc/sysctl.d/99-supascale-realtime.conf
    fs.file-max = 2097152
    net.core.somaxconn = 65535
    net.ipv4.ip_local_port_range = 1024 65535
    
    # docker-compose.override.yml
    services:
      realtime:
        mem_limit: 1536m
        ulimits:
          nofile:
            soft: 1048576
            hard: 1048576
        environment:
          ERL_MAX_PORTS: "524288"
          DB_AFTER_CONNECT_QUERY: "SET search_path TO _realtime"

    Load "Supabase Realtime WebSockets: 10K+ Socket BEAM Tuning" Preset in SupaScale 12-Container Workbench →

    1. SupaScale Routing Rule: Broadcast Channels vs Single-Threaded Postgres CDC

    Supabase Realtime offers three modes: Broadcast, Presence, and Postgres Changes. Because Postgres Changes reads a single wal2json replication stream and checks RLS per listener, we recommend using Broadcast events (triggered from server actions or lightweight DB triggers) whenever room fan-out exceeds 500 concurrent users.

    2. Raising Kong & Realtime File Descriptors in SupaScale Docker Overrides

    Default container ulimits cap open file descriptors near 1,024 to 4,096, causing Kong to drop WebSocket upgrades with HTTP 502 errors during traffic bursts. Raising nofile to 1,048,576 on both kong and realtime containers eliminates descriptor exhaustion.

    3. Regional APAC & EU Latency Considerations in SupaScale Provider Matching

    Interactive Presence cursors and chat rooms are sensitive to round-trip network latency. Deploying self-hosted Supabase on Singapore, Tokyo, or Frankfurt NVMe nodes keeps regional WebSocket heartbeat RTT low compared to cross-ocean cloud regions.

    SupaScale Matched KVM & VDS Tiers for Supabase Realtime WebSockets: 10K+ Socket BEAM Tuning

    SUPASCALE PRIMARY MATCH

    Vultr 3.5GHz+ High Frequency NVMe (Low-Latency pgvector & Realtime) — SupaScale

    From $24/mo (~612k)

    Hourly billing lets you benchmark HNSW pgvector recall on 16GB/32GB HF nodes for cents.

    Check Vultr High Frequency Specs for Supabase Realtime WebSockets: 10K+ Socket BEAM Tuning on SupaScale →
    SUPASCALE RUNNER-UP

    Hostinger KVM NVMe VPS (1-Click Docker / Coolify + Supabase) — SupaScale

    From $4.99/mo (~127k)

    12–24 mo KVM 2 (8GB) or KVM 4 (16GB) locks lowest rate + stacks Extra 20% partner discount.

    Compare Hostinger KVM VPS Options for Supabase Realtime WebSockets: 10K+ Socket BEAM Tuning on SupaScale →

    SupaScale rate citation: Public vendor tariffs retrieved 2026-11-12; promotional and renewal prices change — verify exact checkout pricing before ordering.

    SupaScale Engineering FAQ: Supabase Realtime WebSockets: 10K+ Socket BEAM Tuning

    How does SupaScale prevent PostgreSQL WAL disk bloat if the Realtime container stops?

    Set max_slot_wal_keep_size=4096MB in postgresql.conf so an inactive logical replication slot cannot force PostgreSQL to retain unlimited WAL segments on disk.

    How much RAM does SupaScale budget for Realtime Elixir at 100K MAU?

    At 100K MAU (concurrency factor 1.85), our SupaScale formula budgets ~0.88 GB for Realtime Elixir plus 20% headroom, recommending a 16 GB 4-vCPU server tier.

    Does Kong terminate idle Supabase Realtime WebSocket connections by default?

    No—the official @supabase/supabase-js client transmits Phoenix heartbeat frames every 30 seconds, keeping upstream Kong sockets active inside standard 60-second read windows.