Right now, I am hosting a site on a dedicated server, 8 GB ram, Intel Xeon E3 1230 V3. I am using long polling techniques in order to display information which gets added into a database consistently.
The problem is: so far, after around let's say 20 users come onto the site, it starts lagging and slowing down dramatically. I'm pretty sure the server is strong enough to handle way more people than that. Thus, I am not sure what exactly is the problem. Can long polling using Apache handle that many users? If not, how should I implement real-time information being displayed. And if it can, how should I configure Apache or anything in order to handle around 500-1000 concurrent users.
Any help is appreciated.
The js/Ajax script I'm using for long-polling is the following:
function waitForMsg() {
$.ajax({
type: "GET",
url: "updatelog.php?items=" + items,
async: !0,
cache: !1,
timeout: 1e3,
success: function(data) {
var json = eval("(" + data + ")");
getStatus(), "null" == json.initial ? $("div.betBox").load("displaylog.php") : (diff = json.items - json.initial, getdisplay()), setTimeout(waitForMsg, 1e3), items = json.items
},
error: function() {
setTimeout("waitForMsg()", 1e3)
}
})
}