For a web application, the best storage location would be in the database. Create a database with a field for the article ID and a field for the number of visits. Index the table by the number of visits. Whenever an article is viewed, add a post or enlarge an existing post. When you need to see a list of the most popular, just go to the table.
Databases are often the best answer for storing data in a web application.
In this case, the database will index the table depending on the number of visits. This makes it a little slower to insert and update, but the databases are designed to do the job, so it won't be that bad. Getting this data will always be very fast due to the supported index.
source share