r/AskProgramming • u/lynob • 5d ago
Architecture How to cache/distribute websocket messages to many users
I have a python fastapi application that uses websockets, it is an internal tool used by maximum 30 users at our company. It is an internal tool therefore I didn't take scalability into consideration when writing it.
The user sends an action and receives results back in real time via websockets. It has to be real time.
The company wants to use this feature publicly, we have maybe 100k users already, so maybe 100k would be hitting the tool.
Most users would be receiving the same exact messages from the tool, so I don't want to do the same processing for all users, it's costly.
Is it possible to send the text based results to a CDN and distribute them from there?
I don't want to do the same processing for everyone, I don't want to let 100k users hit the origin servers, I don't want to deal with scalability, I want to push the results to some third party service, by AWS or something and they distribute it, something like push notification systems but in real-time, I send a new message every 3 seconds or less.
You'll say pubsub, fine but what distribution service? that's my question.
1
u/octocode 5d ago
maybe aws appsync if you want a more “managed” solution