Calculate Page views efficiently


#1

Hi,
I am coding forum software in rails. In forum software how many
times a thread is viewed is an important metric .one way of doing this
is creating a before_filter which logs in a view everytime a page is
requested.

actually just because i need to run this before_filter i can’t do page
caching which can drastically improve the performance of the app. can
anyone suggest a better way of logging views of every thread.


#2

Maybe with a distinct insert into a history table? thread_views
(thread_id int, view_count) outside of the before_filter… somewhere
else?

Or parsing of the logs?


#3

sullivan,
thanks for the reply. But the very act of inserting into
any table means i cannot use page caching which will be aserious
performance penalty to pay.

i will explore the logs option though. thanks

Cheers,
Deepu.