0

I have a big enough project still not programmed in my head, where there'll be a few static pages, a lot of managing pages, but also dynamic ones. By dynamic, I mean async, which they'll be updated on a regular basis (let say every second during a specific period of time). I still haven't choose the technology I'll use, but I'm really familiar with .NET technologies. On the other hand, I'm starting to learn NodeJS / Angular. I'm asking because I know I could take a look for tutorials (such as a chat app) but considering I may have 1000 users logged simultaneously, and having a lot of events to handles, I want to be sure of which technologies to use priorly to start coding - also, maybe a "chat-like" app is the best approach too to base my analysis on!

So, what could be the best approach, for this particular scenarios;

  1. On the server, routines will raise many events/start multiple process, every second or so (sometime more, sometime less);
  2. Related to those events, users (maybe a thousand of 'em) would be on a page and keep it open. Every time an event/process occurs, the page MUST be refresh with new values.

So, my final question is;

  • What could be the best / cost efficient way to do this, without (or knowing at least if there's no other way), loading the server with a million of requests and have a lot of server costs?
  • What could be the best tools/technologies/languages, or maybe tutorials shall I look for (independently of the technology, I can learn everything).
  • Finally, things to pay attention, no-go or known issues of doing things like that.

Addendum If the every seconds is too costly, maybe 10 seconds could be an option. But since, what are my possibilities?

Simon Dugré
  • 17,980
  • 11
  • 57
  • 73
  • You can't SEND information to a browser. The browser has to ASK for it. To get one-per-second updates, your pages will have to be doing AJAX requests every second. That's a a lot of requests. You'll want to do testing to make sure you can handle it. – Tim Roberts Feb 10 '22 at 20:01
  • Yeah I know that it's impossible to send to client-end, but I want to get the closest to it as possible. But I want to have it the most "Live" as possible. That's why I think about a "chat-like" app, which is updated/synched every time a message is sent to server (client is then updated or get updated) but instead of a message, this could be a JSON object. The key here is really the "refresh" rate versus the server load. – Simon Dugré Feb 10 '22 at 20:11
  • I think you are guilty of premature optimization. You're fretting about things that you may not need to fret about. Go build your system, using AJAX requests for updating, and see if it's too much load. – Tim Roberts Feb 10 '22 at 20:21
  • @TimRoberts Guilty I am! Maybe, but I know the main concern of my problem, will be my most important feature; the update frequency - the live feeling. So I want to get sure to use the optimal one. And because I do not had to do a lot of "async"-like app so far, I'm not familiar with what are the best way to handle this these days. If you consider AJAX is the best, then, I get your point. – Simon Dugré Feb 10 '22 at 20:27
  • Well, I'm not sure about "best", but there are very few alternatives. You can use `socket.io` to create a direct TCP socket connection between the browsers and your server, but that's a hell of a lot of trouble if you don't need it. – Tim Roberts Feb 10 '22 at 20:37
  • @TimRoberts It sounds like a good answer to me. Socket.IO seems to exactly consists of what is my main point here. I was not aware of the existence of that kind of library. – Simon Dugré Feb 10 '22 at 20:48

0 Answers0