I'm currently using long-polling method to update data in realtime using ajax and php loop:
function getdata(){
//database request...
if(new data){
echo new data;
}
}else{
getdata(); //loop again
}
}
The problem is that this method requires a unique Apache process for every user and eats a lot of memory, so my site can't handle more than 100 users.
Is there any other more efficient method of getting realtime data from mysql database?
Edit: And I need to use additional php function file_get _contents() for every loop to check if data has been changed.
I think that if you will use a unique key fr every user than it can be solve.... For example just put a new num on each customer request and then fetch the last one by using DESC and than check to the new one.