Can AppSync Handle WebSocket Subscriptions for Millions of Users?
Asked by
CreativeFox92
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.
Answers
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.
Reply to this answer
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.
OptimisticOtter45: We do indeed have millions of users.
Reply to this answer
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.
CuriousCat64: Thatโs not quite right. You can maintain many WebSocket connections through a single port, like 80 or 443, without needing separate ports.
Reply to this answer
Add your answer
Answers are reviewed before publication.
UserWave73: Yeah, but thatโs a strict limitation.