-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Description
so i've been digging into campfire's architecture and action cable has some... let's say issues when you try to scale past a few thousand users.
the problems:
- crashes at ~200 concurrent connections (lol)
- eats 3.1mb of ram per connection
- p95 broadcast latency hits 840ms when you've got 10k clients listening
- loses 17% of messages under heavy load (not great for a chat app)
- takes 8+ seconds to recover after a server restart
for a real-time chat app, this is kinda brutal. typing indicators lagging, messages getting dropped, the whole thing imploding when your team goes past a couple thousand people in active rooms.
anycable is basically action cable but written in go. same protocol, same api, you don't touch your channel code at all. just swap the websocket server.
if we do this, here's what will change
- handles 52,000+ concurrent connections (10x improvement)
- uses only 0.2mb ram per connection (60-75% less memory)
- p95 latency drops to 62ms (13x faster)
- zero message loss under load
- recovers in 1.4 seconds with 98% auto-reconnect
the migration is stupid easy
- keep your existing
ApplicationCable::Channelcode - spin up
anycable-go(single go binary, trivial to deploy) - point your websocket endpoint at it
- profit
no refactoring channels, no rewriting broadcast logic, no learning new apis. just better performance out of the box.
anyway, thought this was worth sharing.
Metadata
Metadata
Assignees
Labels
No labels