How to solve the statistics of the number of likes in the Chinese chapter of the website?

was originally intended to use redis"s HyperLogLog for statistics, but since users only have one chance to like each article, it is impossible to keep playing redis to determine whether users have liked it or not. But the efficiency of using mysql is too low. I don"t know if you have any good idea-sharp-sharp-sharp problem description

Oct.16,2021

be reasonable, why do you say mysql is inefficient?
giving likes is a very, very simple operation. And for the client, the real-time requirement of the data is very low.

  • the user opens the article and queries the database whether he / she has been liked and the current number of likes.
  • the number of likes that users want to see after giving likes is + 1. This is realized immediately through the front end, regardless of whether it is actually successful or not. Send it asynchronously to the backend, and cancel likes in the same way

these two points determine that the performance and efficiency requirements of the like system are basically equal to no requirements. It can even be said that as long as the system completes the database update of the like behavior within 10 seconds, the vast majority of users will not feel the impact on the experience.

Menu