Module fast_timeout

Source
Expand description

The fast and more complicated version of pingora-timeout

The following optimizations are applied:

  • The timeouts lazily initialize their timer when the Future is pending for the first time.
  • There is no global lock for creating and cancelling timeouts.
  • Timeout timers are rounded to the next 10ms tick and timers are shared across all timeouts with the same deadline.

In order for this to work, a standalone thread is created to arm the timers, which has some overhead. As a general rule, the benefits of this don’t outweigh the overhead unless there are more than about 100 timeout() calls/sec in the system. Use regular tokio timeout or super::tokio_timeout in the low usage case.

Structs§

FastTimeout
The timeout generated by fast_timeout().

Functions§

fast_sleep
Similar to tokio::time::sleep but more efficient.
fast_timeout
Similar to tokio::time::timeout but more efficient.
pause_for_fork
Pause the timer for fork()
unpause
Unpause the timer after fork()