Skip to content

Ecommerce client wants live chat during flash sale, my server weeps

Web Hosting by olya 5 replies 483 views
#1

Heads up: this is a cautionary tale with actual numbers.

Client on my KnownHost 4GB plan wants live chat for "massive flash sale." I install self-hosted chat app. Pro tip: WebSocket connections are not free.

The math they dont teach you:

  • 1 Apache worker ≈ 15MB RAM
  • 1 WebSocket connection ≈ 0.5MB but never releases until close
  • My plan: 50 concurrent process limit
  • Chat alone hit 47, everything else 503

What I tried:
1. Move chat to subdomain chat.example.com
2. Point to GreenCloudVPS free tier VM (separate from main store)
3. Use Redis pub/sub between nodes so agents see all rooms

Still weeping. 2000 "active users" = maybe 400 actual WebSocket, but my stack cant tell difference.

What community wisdom says (I havent done yet):

  • Offload to managed chat service (CloudCone has websocket proxy?)
  • Use CDN for static, keep sockets on minimal origin
  • Consider SSE instead of WS for one-way updates

Anyone solved this on budget hardware? Client expects "Amazon-level" on $15/month.

licensing is a suggestion
#2

(have you considered) (and this is just me thinking out loud) (that "Amazon-level" (which is a phrase I loathe (deeply))) might require (wait for it) (Amazon-level budget)??

(I ran something similar (chat on a Raspberry Pi (don't ask))) (the trick (if you can call it that)) was (and here I get to my point (finally)) ) aggressive connection pruning (close idle after 30 seconds) (let them reconnect (they wont notice)) (but your process count (she drops (dramatically)))

push. done. coffee.
#3

2000 users is not a DDoS. 2000 persistent connections is a resource exhaustion attack on your architecture.

Filtering layers:
1. Edge: CDN handles TLS, static. Not your origin.
2. Proxy: Varnish or similar for HTTP. Useless for WS.
3. Origin: Your actual bottleneck.

Anycast wont help here. You need connection distribution, not geographic distribution. Scrubbing irrelevant.

If 400 WS = 47 processes, you need ~12:1 ratio. At 2000 users, need 167 process headroom. Your 4GB plan cannot. Math is math.

mitigated 800Gbps before breakfast
#4

Mas tipo

Client expect on budget

Offload =

#5

2000 is nothing

#6

What kernel are you running on that KnownHost box

swimming upstream since 2019 🐟

Post a reply

You need an account to reply. Log in or register to join the conversation.

Post reply Preview Save draft