Reply
Update file views
Old 04-28-2008, 09:12 AM Update file views
Junior Talker

Posts: 1
Name: JOJY
Hello all,

Recently i have been checking mysql server log and found update statements for file views is taking good enough amount of time. Currently i am simply updating a file view counter when ever user visit the file page. Does it make sense to update view counter if user views more than 1 time file page? in a day or so? I think no.. this is my personal experience mysql updates come at cost.. especially when you are using indexes..
I open this thread to discuss the possible solutions.. here are few solutions that i have in mind..

- Set cookie for 24 hrs and store file ids which user visited and check them on each file page (limited due to cookie size)
- Store all values in session instead of cookie
- Create table in database and store all values in db and check table whenever user visit file page. (resource hungry solution)


What would you do if you fall in the same situation?

Thanks,
Jojy
JOJY is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 04-28-2008, 11:28 PM Re: Update file views
addonchat's Avatar
Skilled Talker

Posts: 97
Name: Chris Duerr
You should be able to get incredible performance on simple UPDATEs with MySQL. Before giving up on your updates, I'd like to see your table and queries. If the table is just contains a file id (are you using an integer or an indexed filename) and a count, then it should be blazingly fast as you'd only have one key. What other data are you storing that requires indexing? I'd also be interested in knowing how many queries you're throwing at the database per second, and what the CPU load is for the mysqld process / hardware in use.

Curious to know what optimizations you've made for performance. As an example, unless the data is very important, one thing you might consider doing is stop binlog-ing it.

Most people I know really only care about unique page views anymore. They usually use third party software (awstats was one I used many years ago for instance) or a service like google analytics.

It's nice to know not simply how popular a page is, but where are people coming from, where do they end up after viewing the page, where are they geographically located, what correlation exists between the page's popularity and a sales lead or purchase, etc..

As for your question, what would I do? It depends upon what data I need to collection and how I intend to apply the information.
__________________
Chris Duerr
AddonChat Java Chat Software
http://www.addonchat.com/ - Affiliate Program
addonchat is offline
Reply With Quote
View Public Profile
 
Old 04-29-2008, 03:24 AM Re: Update file views
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
i believe JOJY needs the file view for users ... to sort trough the files he has for download.
I would go with SESSIONS to save the data. Cookies are sometimes blocked ... but sessions are always on.
__________________
If you like my posts ... TK is appreciated:)
Web Directory | Blog
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Reply     « Reply to Update file views
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12089 seconds with 12 queries