How would it be better to implement this in this case? Every time you do not make up requests for UPDATE resources.
Everything depends of course on the power of the server, but, for example, suppose that each request is of the form:
UPDATE news SET count = count + 1 WHERE news_id = 9
takes 0.002 seconds (records in the table ~ 9000). The site is very loaded. Well, let's say, such requests take 50-70 pieces every second. Therefore (this is of course wrong, but if we take the linear dependence into account), we get 0.1 second only for processing a single request! And I need to generate a page (which is not always loaded from the cache)! In practice, it turns out even more. In general, this approach is not suitable here.
The only thing that remains is to write to some temporary source (be it RAM, or tin), and write to the database, for example, only half an hour after the last recording.
Everything seems to be good, if it were not for the tar spoon, as they say ... For all that, I need to keep the possibility of sorting the results of the sample from the database (by the number of views). After all, the data can change in half an hour, and therefore ORDER BY can change significantly, of course, you can do it, but it will not be accurate.
All this I need to, for example, display the most popular entry. Or the top 15 most popular. Well, in general, I want to hear the views of experts on this issue. Thank you in advance.
PS And one more question: is it worth doing the same with the "I like" button (I mean, not the contact button, but the native site button)? Here, as it were, not many requests will have to be done, but they still have to do it. So, if you give some advice, I will be grateful.
UPD:
In general, guys ... Thank you all for the feedback and answers. I will try in every way. As soon as something becomes clear, I will update the question. I think not only is it interesting to me.