I am working on a page that will automatically update certain elements when certain changes are made to my database (mongoDB Atlas)
At the moment, I am requiring the user to manually request (ajax) from client-to-server and retrieve the relevant data.
This is highly inefficient and costly as I am retrieving the data regardless of change. It is also not a smooth user experience.
As far as my novice knowledge goes, I am presented with 2 options:
- Periodically (every few seconds) send a client-to-server request to check if there are any changes. This increases the server hits a lot.
- Send a single client-to-server request and do the periodic checking on the server-side instead.
Is my understanding correct that 1 of my N web workers will be fully occupied with the periodic checking (since request is not replied by server till change is detected) and in this case I can only have up to N users with their dashboard open before exceeding the web worker limit?
Thank you for reading through this!! Appreciate any help or better solutions.