[SOLVED] Server load when pushing the same small payload to a very large amounts of clients


I am wondering what would be the best strategy to send the same small(<100B) payload to large amounts of clients and not paying bank for the server resources.

I am trying to create an API that would synchronize multiple media players to one source for the purpose of watch parties through async data pushing through http. I don’t need to authenticate clients and the data is not sensitive. The payload will be the same for everyone and very small ~20-40 unicode chars. I want the payload to be able to update every 2-3 seconds, but I predict a median update every 30-60s. My limitation is that I want to be able to serve up to a million users at the same time and make it free to use.

I am not sure how to balance the cost of the server resources and high performance of a possibility of a lot of quick updates to clients. Are there any resources that would help me understand the balancing of server cost/performance in my use case? What is the best way to approach this problem from a technical standpoint?

So websockets are out of the question, since streaming data and keeping up sessions is costly, right? Are AJAX pushes the most lightweight way to approach it? How does the fact that the payload is the same for everyone influences possible strategies of lightening the load? Would lack of auth greatly influence the load? Is P2P out of the question?


Best approach would be to use websockets

https://socket.io/ would be a very good starting point,

or https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API

another approach is to use AJAX (as you mention), but that would carry the whole HTTP protocol data with it, on every request, making your payload doubled (if it’s that small).

So binary data via websocket seems the better solution.

Answered By – Ron

Answer Checked By – Clifford M. (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *