expirationd
expirationd copied to clipboard
How to run expirationd periodically?
I want to run the expirationd periodically without manually triggering it. For example, I want to run it once every hour. Is it possible?
It seems, it worth to clarify how expirationd works. The schema is the following:
- Process min(
space_length
,tuples_per_iteration
) tuples. - Sleep
tuples_per_iteration
×full_scan_time
/space_length
(but not beyond 1 second). - Repeat 1-2 until the whole space will be traversed.
- Sleep 1 second.
- Repeat 1-4.
Example 1:
For given values:
| space_length = 10^6
| tuples_per_iteration = 1024 (default)
| full_scan_time = 3600 (default, 1 hour)
We can calculate delay = min(1024 * 3600 / 10^6, 1) = 1.
The processing will look so:
+-> process 1024 tuples
| sleep 1 second
| <..975 more such steps..>
| process 576 remaining tuples
| sleep 1
| sleep 1
| (978 seconds of delays in sum, ~16 minutes)
+-- start again
Example 2:
For given values:
| space_length = 10^6
| tuples_per_iteration = 1
| full_scan_time = 3600 (default, 1 hour)
We can calculate delay = min(3600 / 10^6, 1) = 0.0036.
The processing will look so:
+-> process 1 tuple
| sleep 0.0036 seconds
| <..10^6-1 more such steps..>
| sleep 1
| (3601 seconds of delays in sum, ~1 hour)
+-- start again
I think everything will be less obscure if we'll add ability to control maximum sleep time after processing of tuple_per_iteration
tuples (now the maximum is 1 second) and to control a sleep time after traversing the whole space (it is hardcoded to 1 second). I hope we'll do it in PR #19. When it will be done, I'll return here with some recipes.
Need to add the comment https://github.com/tarantool/expirationd/issues/38#issuecomment-715667451 into README
NB: Don't forget to add full_scan_delay
into the processing schema and the examples above, when we'll adopt them for README.