Question

I am beginning to learn AJAX and SSE. Performance wise which method would be considered better? Assume my application will cater to 1000 clients.

  1. Having Server sent events which keep 1000 http connections open for one way communication to push updates to the clients.

    or

  2. Having the clients implement ajax polling for every 1 second to the server.

Was it helpful?

Solution

You do not want to have each client poke your server every 1 second. Just make the math: 1000 requests every second. As soon as one of the request starts taking more than 1 second, you will slowly start to launch a Denial of Service on your own server.

I don't know if you are in the ASP.NET environment for the server, but if you are, I suggest that you take a look at the SignalR library.

A typical demo app for SignalR is a chat program. See ChatJS or Jabbr.

You can follow this tutorial to learn more about SignalR.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top