Answer the question
In order to leave comments, you need to log in
Is there a way to update records in the database later?
There is some data that is updated in real time. Based on them, the values are calculated, which are entered into the database on the basis that each user has his own set of resulting values.
Common sense suggests that doing UPDATEs for all users and recalculating values in real time is irrational, because the data is displayed only for those who are logged in (and this is a very small part of the total number of users).
How, in such cases, do they act “according to science”, so that first of all, those who are online have up-to-date data, and for everyone else, the data is recalculated with a lower priority?
PS: The database is planned to use MySQL, but I'll be happy to hear about others if they help solve the problem.
Answer the question
In order to leave comments, you need to log in
You need a queue. From the script, the data is put (push) into the queue, and then the cron gets out of it (pull) and processed. Almost all the popular functionality of most highload projects (for example, a messenger) works there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question