I'm setting up an infrastructure that involves DynamoDB with streams enabled, and I need to push events to all users in real time via WebSocket connections. My goal is to support millions of users connecting concurrently. I'm really curious if AppSync can scale to handle that many connections, and if so, what best practices exist for implementation. If AppSync isn't suitable for this scale, I'd like to know what alternative services might be better suited for my needs. Keep in mind, I'm constrained from using a notification mechanism.
3 Answers
From what I understand, traditional WebSocket setups can be tricky since they typically require a separate port per user, limiting scalability to under 65k connections per server. If you don’t strictly need real-time communication, you might want to consider intermittent polling as a more scalable alternative.
It's great that you're starting with AppSync! If you genuinely have millions of users, it’s smart to build a few proof of concepts just to see how everything holds up under load. If you run into issues with AppSync, you could always set up your own WebSocket server or try Server-Sent Events for a more straightforward implementation when real-time delivery isn't a must.
We do indeed have millions of users.
For your use case, AppSync Events might be a viable option since it utilizes WebSockets. Just keep in mind that there’s a limitation of 50 channels at a time, which can be a bottleneck if you're expecting a high volume of concurrent connections.
Yeah, but that’s a strict limitation.
That’s not quite right. You can maintain many WebSocket connections through a single port, like 80 or 443, without needing separate ports.