expirationd icon indicating copy to clipboard operation
expirationd copied to clipboard

How to run expirationd periodically?

Open santhoshTpixler opened this issue 5 years ago • 3 comments

I want to run the expirationd periodically without manually triggering it. For example, I want to run it once every hour. Is it possible?

santhoshTpixler avatar Jul 30 '19 05:07 santhoshTpixler

It seems, it worth to clarify how expirationd works. The schema is the following:

  1. Process min(space_length, tuples_per_iteration) tuples.
  2. Sleep tuples_per_iteration × full_scan_time / space_length (but not beyond 1 second).
  3. Repeat 1-2 until the whole space will be traversed.
  4. Sleep 1 second.
  5. 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.

Totktonada avatar Oct 24 '20 03:10 Totktonada

Need to add the comment https://github.com/tarantool/expirationd/issues/38#issuecomment-715667451 into README

akudiyar avatar Apr 23 '21 11:04 akudiyar

NB: Don't forget to add full_scan_delay into the processing schema and the examples above, when we'll adopt them for README.

Totktonada avatar Jul 23 '21 22:07 Totktonada