Answer the question
In order to leave comments, you need to log in
How to optimize constant PHP updates?
Hello!
There is a PHP application that notifies people about the current state of the server (for example).
Now this is done with jQuery, which sends an AJAX request to the server every 30 seconds and receives a response, which it displays to the user.
The problem is that now I have a very large number of requests and this is very heavy on the server.
Question: How can we optimize the process of delivering updates to users?
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
You can deliver data to the client using websockets, you can stop generating an AJAX request on inactive tabs.
But in general, every 30 seconds is not a load at all. How many users do you need to have on the site at the same time in order to generate many requests in total every 30 seconds? Perhaps the backend itself is not optimized for you? Heavy features? Complex database queries? Not optimal algorithms?
Bullshit. PHP for real-time alerts is NOT INTENDED! Either use normal code, or switch to nodejs!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question