I would like to ask for feedback for some programming logic concept & ideas. I am building a site where i would like to keep track on how many pageviews a page has daily. I have thought of 2 ways to do it, would like to get feedback from fellow experts on which approach you would recommend.
Keep a field in the document called pageviews. On every page load, i would increment this value by 1. This seems to be the most naive way of doing it. However, i am concern on the database performance. Imagine i have 10000 concurrent users on that page, or a hacker is auto-refreshing this page every millisecond.
Create a file (maybe .txt). And push data into it every pageview. I can tabulate the pageviews based on the data stored in the txt file. Using this approach, there will be no database load, will this be a better approach?
Appreciate more expert views on how you would go about doing this.