I am currently storing each view in database with user IP, view date etc. But mine website has large number of hits and it is increasing the database locking time and decreasing performance.
I was thinking to save the counts in a file for 1 hour and then update the database but somebody told me that we don't use file operations for heavy load sites.
Please suggest me best strategy to do this.
Note: I don't need to count the unique views.
Your webservers logs will already be tracking much of this data for you.
What I'd suggest is rotating the logs once an hour and then have a scheduled job that produces the aggregate stats and stores them in the DB.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With