Closed Thread
Results 1 to 2 of 2

Thread: ajax chat making high recourse limit

  1. #1
    linkenpark51471 is offline x10Hosting Member linkenpark51471 is an unknown quantity at this point
    Join Date
    Nov 2010
    Posts
    26

    ajax chat making high recourse limit

    what are some things i can do to make a ajax chat less of a CPU hog?

  2. #2
    essellar's Avatar
    essellar is offline Community Advocate essellar has a spectacular aura about
    Join Date
    Feb 2010
    Location
    Toronto, Ontario, CA
    Posts
    1,152

    Re: ajax chat making high recourse limit

    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.
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
    "It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)

Closed Thread

Similar Threads

  1. Ajax Chat triggers HRU
    By wc3garage82 in forum Free Hosting
    Replies: 1
    Last Post: 04-26-2011, 04:57 AM
  2. ajax chat
    By muntadev in forum Free Hosting
    Replies: 1
    Last Post: 09-01-2008, 06:16 AM
  3. Ajax Chat
    By KSclans in forum Scripts & 3rd Party Apps
    Replies: 3
    Last Post: 07-14-2008, 10:51 AM
  4. Ajax chat allowed?
    By Rolus in forum Free Hosting
    Replies: 2
    Last Post: 06-08-2008, 03:43 PM
  5. Help with Ajax Chat
    By KSclans in forum Free Hosting
    Replies: 9
    Last Post: 03-23-2008, 06:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers