Skip to content

Guide

Sizing a 24 GB or 48 GB VPS for PostgreSQL, Redis and n8n

Consolidating PostgreSQL, Redis, n8n in queue mode, Evolution API and multiple client services onto a single 24 GB or 48 GB VPS cuts your cost per gigabyte of RAM and simplifies maintenance compared to juggling six tiny servers. The catch is memory discipline: without explicit caps, one runaway SQL query or a burst of webhook payloads with PDF attachments can trigger the Linux OOM killer and take down every client database at once.

On this page
  1. 24 GB vs 48 GB: where each tier fits
  2. Memory budget layer by layer
  3. Practical PostgreSQL tuning (24 GB and 48 GB)
  4. Redis for n8n queues: enforce `noeviction`
  5. Per-client isolation in Docker Compose
  6. When RAM is no longer your bottleneck (SSD vs NVMe vs VDS)
  7. Next steps

This guide lays out practical RAM, vCPU and SSD budgets for 24 GB and 48 GB hosts, along with concrete PostgreSQL, Redis and Docker Compose limits that keep multi-tenant servers predictable.

24 GB vs 48 GB: where each tier fits

On Nuvits High-memory VPS plans, both 24 GB and 48 GB are available in Germany and United States (East) on standard SSD storage (for write-heavy databases that need NVMe IOPS, see Performance NVMe VPS). Here is how the two tiers compare in production:

Plan Hardware specs Runs comfortably Sign you have outgrown it
VPS 24 GB 8 vCPU · 24 GB RAM · 300 GB SSD Shared PostgreSQL + Redis + n8n queue mode (1 main + 2–3 workers) + 5–10 Evolution API instances or 3–5 client apps Postgres cache competing with workers during peak hours, or Coolify builds pushing swap
VPS 48 GB 12 vCPU · 48 GB RAM · 400 GB SSD Large PostgreSQL with hot indexes in RAM + Redis + n8n queue mode (4–6 workers + webhook processor) + 15–30 isolated client workloads Sustained CPU above 80% or persistent SSD iowait (time for NVMe or Dedicated CPU VDS)

Memory budget layer by layer

Never assign 100% of host RAM to containers. The Linux kernel needs 20% to 25% free memory for filesystem page cache, network buffers and brief spikes during docker build or pg_dump.

Suggested split on a 24 GB VPS

Layer Cap (mem_limit) Role
OS + Docker + Caddy/Traefik + monitoring ~2 GB Base overhead, TLS and metrics
PostgreSQL 18 6 GB shared_buffers=3GB, leaving 3 GB for connections and work_mem
Redis (n8n Bull queue + cache) 1.5 GB maxmemory 1024mb with AOF persistence enabled
n8n (main + 2–3 workers + runners) 5 GB 1 GB for main, 1 GB per worker, 512 MB per n8nio/runners sidecar
Client apps / Evolution API / Chatwoot 3.5–4.5 GB Explicit per-service limits in Compose
Linux page cache + burst headroom 5–6 GB 21%–25% free for disk cache, backups and traffic spikes

Suggested split on a 48 GB VPS

Layer Cap (mem_limit) Role
OS + Docker + proxy + Coolify/monitoring ~3 GB Base overhead and deployment agent
PostgreSQL 18 14 GB shared_buffers=8GB, effective_cache_size=26GB
Redis (dedicated queue + separate cache) 3 GB Split critical queues (noeviction) from disposable cache (allkeys-lru)
n8n (main + webhook + 4–6 workers + runners) 9 GB High parallelism without freezing the editor
Client apps / Evolution API / APIs 7–9 GB Per-client RAM and CPU caps
Linux page cache + burst headroom 10–12 GB 21%–25% free for pg_dump, VACUUM and builds

Practical PostgreSQL tuning (24 GB and 48 GB)

PostgreSQL ships with conservative defaults (shared_buffers = 128MB) that waste most of a large VPS and push avoidable reads down to disk.

Because PostgreSQL shares this server with Docker, Redis and n8n, tune postgresql.conf more conservatively than you would on a database-only host:

postgresql.conf
# Example for a 48 GB VPS shared with Redis, n8n and client apps (for 24 GB, use shared_buffers = 3GB and effective_cache_size = 13GB)
shared_buffers = 8GB
effective_cache_size = 26GB
work_mem = 16MB
maintenance_work_mem = 1GB
max_connections = 200
checkpoint_completion_target = 0.9
wal_buffers = 16MB
random_page_cost = 1.1
effective_io_concurrency = 200

Three habits prevent sudden memory spikes:

  • Keep work_mem modest: PostgreSQL allocates work_mem per sort or hash operation per connection, not globally. Across 200 active connections, 16MB can still consume several gigabytes during concurrent reporting.
  • Add PgBouncer past 10 clients or 4 workers: rather than raising max_connections to 500, pool idle client connections in transaction mode so PostgreSQL stays lean.
  • Prune n8n execution history: keep EXECUTIONS_DATA_PRUNE=true and EXECUTIONS_DATA_MAX_AGE=168 enabled so execution_entity does not quietly grow to tens of gigabytes.

Redis for n8n queues: enforce noeviction

A common multi-tenant mistake is setting maxmemory-policy allkeys-lru on the same Redis instance that backs n8n queues. LRU eviction works fine for disposable page cache, but on Bull/BullMQ queues it silently drops job metadata and breaks workflows.

Follow two clean rules:

  1. For the queue Redis instance, set an explicit maxmemory with --maxmemory-policy noeviction and --appendonly yes. If workers fall behind and fill memory, Redis surfaces a clear error instead of corrupting queued jobs.
  2. For disposable app caching, run a separate lightweight Redis container with --maxmemory-policy allkeys-lru and no AOF.
docker-compose.yml
services:
  redis-queue:
    image: redis:7-alpine
    restart: always
    command:
      - redis-server
      - --appendonly
      - "yes"
      - --maxmemory
      - 2gb
      - --maxmemory-policy
      - noeviction
      - --requirepass
      - ${REDIS_PASSWORD}
    mem_limit: 2560m
    cpus: "1.5"

Per-client isolation in Docker Compose

When multiple client services share a 24 GB or 48 GB host, a single memory leak or runaway container log file can fill the root filesystem or starve PostgreSQL. Put explicit memory, CPU and log-rotation caps on every service:

docker-compose.yml
services:
  client-a-api:
    image: ghcr.io/your-org/client-a:1.4.2
    restart: unless-stopped
    mem_limit: 1536m
    mem_reservation: 512m
    cpus: "1.5"
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"

Pair container caps with a 4 GB safety swapfile (vm.swappiness=10) so brief bursts do not immediately invoke the OOM killer, and give each client its own PostgreSQL database and role so individual backups and future migrations stay straightforward.

When RAM is no longer your bottleneck (SSD vs NVMe vs VDS)

Even with 48 GB of RAM, two metrics tell you the constraint has moved to storage or CPU:

  • Persistent iowait (vmstat 2 10 showing wa > 15%) during webhook bursts, Postgres checkpoints or dumps: move the database workload to a Performance NVMe VPS with NVMe storage and newer AMD EPYC CPUs.
  • Sustained high CPU or noticeable st (CPU steal) with heavy workers, media processing or analytics: move the core workload to a Dedicated CPU VPS (VDS) with physically reserved cores.

Next steps