ajax chat making high recourse limit

Status
Not open for further replies.

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
Well, the first thing would be to increase the interval between requests from the browser. You'll still want the send to be real-time on enter, but you can spread the "listen" period out quite a bit before the system starts to feel like it's just a one-sided conversation. That's a pretty simple matter of adjusting a single value in JavaScript (normally).

If it's a chat of your own design, then you'll want to make the request to the database as compact as possible, and retrieve as little as you can get away with. Indexing the table to make the search as fast as it can be would be a good idea (I can't get more specific without knowing how the chat is structured), and order the data so that the least amount of transformation occurs on each request. (This would be one of those times when denormalizing the data -- storing the chat lines as a single, formatted value, like a JSON string, on every send request, and using separate keys only for searching -- is better than getting all Codd-approved-normal-forms with the database design.) Do the work on send -- it happens a lot less frequently than the listen requests.
 
Status
Not open for further replies.
Top