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§
- Fast
OrTokio Timeout - The timeout selector generated by fast_timeout().
- Fast
Timeout - The timeout generated by fast_timeout().
Constants§
- DEFAULT_
FAST_ TIMEOUT_ TO_ TOKIO_ THRESHOLD - Default duration above which
fast_timeout()falls back to Tokio’s timeout.
Functions§
- fast_
sleep - Similar to tokio::time::sleep but more efficient.
- fast_
timeout - Similar to tokio::time::timeout but more efficient.
- fast_
timeout_ to_ tokio_ threshold - Return the duration above which
fast_timeout()falls back to Tokio’s timeout. - pause_
for_ fork - Pause the timer for fork()
- set_
fast_ timeout_ to_ tokio_ threshold - Set the duration above which
fast_timeout()falls back to Tokio’s timeout. - unpause
- Unpause the timer after fork()