A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AJAX Idea for Web Stats

  1. #1
    Wannabe PHP Wizard
    Join Date
    Nov 2001
    Leechburg, PA

    AJAX Idea for Web Stats

    As somewhat of a gimmick, I want to create a small AJAX based stat tracking tool that would display live page views as they happened.

    The basic concept is:

    * User views page on site.
    * Script adds view to database.
    * Application using setInterval checks database every 10 seconds or so for updates. If it find them, it refreshes the new data list.

    So, my question is: Does the endless loop at setInterval creates cause any kind of long term memory build up and would I have to somehow clear a cache eventually, or could this thing run for 24 hours straight and not crash?

    Clinton N Godlesky
    My Stuff:
    http://www.15656.com/clint http://www.statedirt.com
    Personal Development Projects:

  2. #2
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Rome, Italy.
    A set interval won't request any more memory than what you intend on using.
    If you always re-use resources.. (same variables).

    The problem with Javascript is it's unreliability. You can't certify that the interval is going to be ok for 24 hours or more without crashing.
    By crashing I mean the JS in your page, not the computer: which would result in no more actions to be executed untill the user refreshes the page.

    The logic of your feature is not optimized: there is no need to use a conditional on wether the number of visits has been updated or not.. through Ajax just load the value each time (you will get about the same bandwidth consumption and reduce the workload on either the server or the client).
    Altruism does not exist. Sustainability must be made profitable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center