Online Counter [The best way to do it?]

BEst way to build online counteR?

Page 1 of 1

2 Replies - 1354 Views - Last Post: 03 May 2009 - 08:20 PM Rate Topic: -----

#1 hrvoje89  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 63
  • Joined: 05-February 09

Online Counter [The best way to do it?]

Post icon  Posted 03 May 2009 - 05:14 PM

Hello all,

I know how to build online counter :) but! I don't know if it is the best way...
Why the best way? Because... what if i have a web page with over 5000 page
open per day (around 4 visitors per minute) ... so each visitor updates DB,
and then each minute cron job checks for old users and deletes them from DB...

but! What if i have a page with 50 users per minute...that means 50 mysql querys per minute..
and cron job.. is that the best way or is there some other,better way?

I would do next thing... each user updates DB (Insert INTO table...) then cron job every minute checks
if the session from table is still active.. if not.. deletes the row with that session.... is that good solution if
you have 10 000+ users on page per day?

Ty!

Is This A Good Question/Topic? 0
  • +

Replies To: Online Counter [The best way to do it?]

#2 bmoyles0117  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 27
  • Joined: 17-April 09

Re: Online Counter [The best way to do it?]

Posted 03 May 2009 - 06:57 PM

Can you please elaborate as to why you are deleting users with the chron job? or even why you are using a chron job at all?
Was This Post Helpful? 0
  • +
  • -

#3 rharriso  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 45
  • Joined: 29-April 09

Re: Online Counter [The best way to do it?]

Posted 03 May 2009 - 08:20 PM

I've been using the program called Woopra. You should check it out. Their online counter is pretty accurate.

I'm not really sure how it works, but I'm pretty sure that it sends an ajax request to their site when each page is loaded, and I believe again when a page is left. That way you know when a user logs off.

I want to write it on my own. It seems like a difficult problem to tackle.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1