New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flexible timeouts #1840
Merged
Merged
flexible timeouts #1840
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add h2o_timeout_val_t structure to differentiate set/unset - Rename h2o_timerwheel_* to h2o_timeout_*
We can fetch the values directly from globalconf
…e timeout (NOT as an indication of the timeout being disabled)
…spose `h2o_timeout_t` after the callback of an _entry_t was invoked)
…o have been expired
kazuho
force-pushed
the
kazuho/timerwheel
branch
from
September 1, 2018 07:35
f1b0177
to
e66017b
Compare
kazuho
force-pushed
the
kazuho/timerwheel
branch
from
September 1, 2018 20:59
e66017b
to
ce21c17
Compare
Instead of renaming `h2o_timeout_entry_t` to `h2o_timeout_t` (a type that no longer exists with the PR), the commit introduces `h2o_timer` while eliminating `h2o_timeout_` entirely. The new timeout mechanism is called "h2o_timer" throughout libh2o. For evloop, "h2o_timerwheel" is used *internally*.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Until now, H2O's timeout handling is based on the assumption that there would be many delayed callbacks that share a small number of fixed "intervals", which has been true for HTTP. For example, all the idle connections refer to a single "interval" called "keepalive timeout."
However, the inflexibility is starting to bite us. For example, mruby's sleep function sets an arbitrary amount of milliseconds. QUIC also breaks the assumption; every connection has different RTT, and we need to set timers based on RTTs.
This PR switches the timeout mechanism used by evloop to "timer wheel", as well as changing that of the libuv binding to directly use
uv_timer
. For more information about timer wheel, see https://lwn.net/Articles/152436/.Changes to the API:
Previously, we had two objects related to timeout handling.
h2o_timeout_entry_t
was the callback object.h2o_timeout_t
was an anchor that contained a linked list ofh2o_timeout_entry_t
s that shared the same amount of delay.The PR replaces the two with one type called
h2o_timer_t
. It is a callback object that can be assigned an arbitrary amount of delay.