+ 1
Is it fine to use AJAX to reload a page content in PHP every 0.5 second? Won't it impose any drawback on the performance?
I am creating a social networking site in PHP where I need to display msgs of all the live people chatting with each other (just as we see in chatrooms). I am using JQuery AJAX functionality to fetch new msgs from the database of every user on the screen every half a second (0.5 second). I'm afraid if this could cause any performance issues later in my application. Won't it slow down my browser or crash the app when so many requests will be generated by the script every 0.5 sec for each user? Is there any better alternative?
1 Odpowiedź
0
in my experience anything that loops can create massive load later on if there is more data involved.
so it depends what you are doing every 0.5 seconds. if you are doing something that will increase as more users are involved then yes, it probably won't scale.
I learned to try to avoid using loops if they are not needed.