Skip to content

Instantly share code, notes, and snippets.

@pattanun-np
Created January 27, 2026 12:21
Show Gist options
  • Select an option

  • Save pattanun-np/9524eb3e0052ba7b59ab0bb3836a64cf to your computer and use it in GitHub Desktop.

Select an option

Save pattanun-np/9524eb3e0052ba7b59ab0bb3836a64cf to your computer and use it in GitHub Desktop.
Soketi WebSocket Server - Cost Analysis for 100K Collaborative Sessions (GKE vs Cloudflare Containers vs VPS)

Soketi WebSocket Server - Cost Analysis for 100,000 Collaborative Sessions

Date: 2027-01-27 Analysis: Comparing deployment options for Pusher-compatible WebSocket server


Overview

Soketi is an open-source, Pusher Protocol v7 compatible WebSocket server built on uWebSockets.js.

Performance Benchmarks (Official)

  • 2 vCPU / 2GB RAM → ~500 concurrent connections @ 6ms latency
  • Built on uWebSockets.js (8.5x faster than Fastify, 10x faster than Socket.IO)
  • ARM/Graviton instances provide 30% better performance

Capacity Planning for 100,000 Concurrent Sessions

Concurrent Users Estimated Resources Notes
500 2 vCPU / 2 GB Single instance
5,000 4 vCPU / 4 GB Single instance
50,000 16 vCPU / 16 GB Multiple instances + Redis
100,000 32 vCPU / 32 GB Horizontal scaling required

Requirements for 100K sessions:

  • ~32 vCPU total
  • ~32 GB RAM
  • Redis for horizontal scaling (pub/sub)
  • Load balancer for traffic distribution

Option 1: Google Kubernetes Engine (GKE)

Configuration

Nodes: 4x e2-standard-8 (8 vCPU, 32GB each)
Total: 32 vCPU, 128 GB RAM
Redis: e2-medium (2 vCPU, 4GB)
Region: us-central1

Monthly Cost Breakdown

Component Spec On-Demand 1-Year CUD 3-Year CUD
GKE Management Cluster fee $72 $72 $72
Compute (4x e2-standard-8) 32 vCPU, 128GB ~$800 ~$640 ~$320
Redis Instance e2-medium ~$75 ~$60 ~$30
Load Balancer Network LB ~$20 ~$20 ~$20
Total ~$967 ~$792 ~$442

Pros

  • Already have existing infrastructure
  • Full control over configuration
  • Predictable pricing
  • Can use committed use discounts (up to 70% off)

Cons

  • Pay for idle resources
  • Management overhead
  • No automatic global distribution

Option 2: Cloudflare Containers

Pricing Model (Updated Nov 2025)

  • CPU: $0.00002/vCPU-second (usage-based, not provisioned)
  • Memory: $0.0000025/GiB-second
  • Disk: $0.00000007/GB-second
  • Egress: $0.025-0.05/GB

Workers Standard Plan Included ($5/mo base)

  • 375 vCPU-minutes
  • 25 GiB-hours
  • 200 GB-hours disk
  • 500GB-1TB egress

Instance Types Available

Type RAM vCPU
dev 256 MB 1/16
basic 1 GB 0.25
standard 4 GB 0.5

Monthly Cost Estimate (100K sessions)

Configuration: 8x standard instances (horizontal scaling with Redis)
Total: 4 vCPU, 32 GB RAM (distributed)
Assumption: 30% average CPU utilization
Component Calculation Cost
CPU 4 vCPU × 0.3 util × 2,592,000s × $0.00002 ~$62
Memory 32 GB × 2,592,000s × $0.0000025 ~$207
Disk 10 GB × 2,592,000s × $0.00000007 ~$2
Egress 100 GB × $0.025 ~$3
Base Plan Workers Standard $5
Total ~$279/mo

Scale-to-Zero Benefit

If traffic is intermittent (e.g., 8 hours/day active):

  • Cost reduces to ~$93/mo

Pros

  • Scale-to-zero (pay only when active)
  • Global edge deployment automatic
  • No infrastructure management
  • DDoS protection included

Cons

  • Instance size limits (max 4GB RAM, 0.5 vCPU per instance)
  • Requires horizontal scaling architecture
  • Beta platform (as of 2025)
  • External Redis/state management needed

Option 3: Simple VPS + Cloudflare Proxy

Configuration Options

Provider Spec Monthly Cost
DigitalOcean 32 vCPU / 64 GB Dedicated ~$336
Vultr 32 vCPU / 64 GB Bare Metal ~$350
Hetzner AX52 (32 vCPU / 64 GB) ~$120
OVH Advance-2 (32 vCPU / 64 GB) ~$180

Additional Costs

  • Cloudflare Proxy: FREE (SSL, DDoS, caching)
  • Redis: Self-hosted on same server or managed (~$15-50/mo)

Total Estimate

Setup Monthly Cost
DigitalOcean + Self-hosted Redis ~$350
Hetzner + Self-hosted Redis ~$130
Vultr + Managed Redis ~$400

Pros

  • Simple architecture
  • Predictable costs
  • Full root access
  • No container/K8s complexity

Cons

  • Single point of failure (unless replicated)
  • Manual scaling
  • No auto-healing
  • Regional deployment only

Option 4: Commercial Alternatives (for comparison)

Service 100K Connections Notes
Pusher ~$500-1,000+/mo Per-connection pricing
Ably ~$400-800/mo Enterprise tier
soketi.app (hosted) Unknown May be discontinued

Cost Comparison Summary

Platform Monthly Cost Notes
GKE (on-demand) ~$970 Full control, existing infra
GKE (3-year commit) ~$440 Best for long-term
Cloudflare Containers ~$280 Scale-to-zero, global edge
CF Containers (8hr/day) ~$93 Intermittent traffic
DigitalOcean VPS ~$350 Simple, predictable
Hetzner VPS ~$130 Best value, EU-based
Pusher (commercial) ~$500-1,000+ Managed service

Recommendation

If you have existing GKE:

Use GKE with committed use discounts

  • Cost: ~$440/mo (3-year) or ~$792/mo (1-year)
  • Leverage existing infrastructure and expertise
  • Add Cloudflare in front for SSL/DDoS (free)

If starting fresh:

Consider Hetzner + Cloudflare Proxy

  • Cost: ~$130/mo
  • Best price-to-performance ratio
  • Simple architecture

If traffic is variable/intermittent:

Cloudflare Containers

  • Cost: ~$93-280/mo depending on usage
  • Scale-to-zero capability
  • Global edge deployment

Architecture Diagram

┌─────────────────────────────────────────────────────────────────┐
│                         CLIENTS                                  │
│              (Web, Mobile, IoT devices)                         │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│                    CLOUDFLARE (Free Tier)                       │
│         SSL Termination │ DDoS Protection │ Load Balancing      │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│                     SOKETI CLUSTER                               │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐        │
│  │ Soketi 1 │  │ Soketi 2 │  │ Soketi 3 │  │ Soketi 4 │        │
│  │ 8 vCPU   │  │ 8 vCPU   │  │ 8 vCPU   │  │ 8 vCPU   │        │
│  └────┬─────┘  └────┬─────┘  └────┬─────┘  └────┬─────┘        │
│       └─────────────┴─────────────┴─────────────┘               │
│                             │                                    │
│                             ▼                                    │
│                    ┌──────────────┐                             │
│                    │    REDIS     │                             │
│                    │  (Pub/Sub)   │                             │
│                    └──────────────┘                             │
└─────────────────────────────────────────────────────────────────┘

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment