Which program is usually used in website development to count the number of views today, the number of posts today, and so on?

  1. Reading websites often have today"s page views, today"s posts, today"s comments and so on. Which statistical scheme is better?
  2. file + Cookie mode, the file on the server is emptied once in 24 hours. the dat file is accessed only once by the client cookie, user within 24 hours.
  3. data table records, these fields are extracted separately as a table, and then combined with ip records into the table.
  4. data table statistics. Use createTime and count aggregate functions to count these fields directly.
  5. Redis, puts the statistics into redis and expires within 24 hours.

do you have any good ways to do this?
after thinking about these schemes, I feel that each has its own advantages and disadvantages. For websites with a general ip volume of about 100000, which one is better?

Mar.06,2021

GA, CNZZ, or open source piwik can also be seen.


  • abstracts all statistical nouns into a string, such as the number of page views today , abstracts into today:views , and then makes statistics
  • for this word.
  • users access and write once every 24 hours: record with Redis
  • data table records today:views data; IP, users who do not need to record (if there is a business need, record separately)
  • external API for data statistics, Redis records; post Synchronize to database

use redis to store access records, and write to the database every few hours. Every day at 23:00 at midnight, the visit records are counted and stored in a statistical table. The access records only store the data of the most recent week, and delete


early statistics in the program every day when the time exceeds. The current practice is to count through log analysis or burying points through third-party data analysis tools such as Google's GA

Menu