ajax - Implementing visitors statistics for many users -


i'm facing challenge , need opinion, let me explain:

i have database of around 300 000 users, have profile page, , store amounts of visitors visit profile on weekly ( or daily?) basis reporting purpose (graph available on admin page).

i'm thinking doing in dedicated table (let's call "stat") organised follows:

  • id / integer (id of users -- unique)
  • current_ip / text (serialized array of ip of visitors of current period)
  • statistics / text (serialized array of statistics per period)

i'm thinking ajax request on profile page filter non-robot user, check if ip exist in ´current_ip´ table (with request) , if doesn't exist unserialize ´current_ip´, push ip of new visitor, serialize ip , update table.

at end of each period (so every week or every day) i'm thinking cron task counting number of ip un 'current_ip', push number (with date) in 'statistic' value (using same method explained), , delete ´curent_ip´ value it´s empty next period.

btw i'm using php5 , postgresql (9.1) i5 (4 x 3.2 ghz) in ubuntu 12.04lts dedicated server ssd , 16g ram.

is best, easiest or fastest way of doing it? wrong?! should use 1 line per period instead of using serialized array store historical values?!

any suggestion welcome =)

cheers

geoffrey

use hbase counters instead of postgres. it's more eficient purpose.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -