R
R
radik28062016-03-22 17:46:57
PHP
radik2806, 2016-03-22 17:46:57

How to run a function strictly at the specified time with an accuracy of up to a minute, while the time is in the database and the database cannot be loaded?

There is a service for working with vk.com. In short, users add posts to the database. Users also indicate on what schedule to post these posts, for example, once a day at 14.00. That is, the database contains a timestamp with the date when the post should leave.
You need to figure out how to run the posting function strictly at the specified time, up to a minute.
Putting a script in kroner, which will pull the base every minute is not a hunt, there will be too much load. The base will collapse, the entire service will collapse
Write a bunch of tasks in cron, for each post its own, also an option, we have already tried it, the server hangs up.
The only thing that came to mind more or less adequate was to create another database on sqllite, with schedules. Thus, remove the load from the main base. But the solution is clearly a crutch.
Guru of high loads, tell me a more elegant method)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Melkij, 2016-03-22
@melkij

If one request per minute from cron is too much, then the problem is somewhere else.

J
jaxel, 2016-03-22
@jaxel

Putting a cron script that will pull the base every minute is exactly what you need. It will not give any load to the base. In the same place the elementary on one table.

R
radik2806, 2016-03-22
@radik2806

How did you determine that the select is the simplest?) The
table with schedules must at least be joined to users, and users should be joined with a table where information about user activity is stored (the paid period may end).
In general, we will omit demagogy, if you do not know a solution that meets the conditions in the question, do not write

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question