Commit Graph

95 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa c10a55588b Implement RFC 9218 extensible prioritization scheme
This commit implements RFC 9218 extensible prioritization scheme.  It
is enabled when a local endpoint submits
SETTINGS_NO_RFC7540_PRIORITIES = 1.  This commit only handles priority
signal in HTTP request header field.  Priority header field in
PUSH_PROMISE is not supported.

HTTP messaging must be enabled to take advantage of this
prioritization scheme because HTTP fields are not parsed if HTTP
messaging is disabled.
2022-06-12 16:06:04 +09:00
Tatsuhiro Tsujikawa 9812a0bc81 Add SETTINGS_NO_RFC7540_PRIORITIES
Add SETTINGS_NO_RFC7540_PRIORITIES to disable RFC7540 priorities.  If
disabled, streams are served in FIFO.
2022-06-11 16:50:07 +09:00
Dimitris Apostolou ad0c9eebf7 Fix typos 2022-01-16 21:53:44 +09:00
Tatsuhiro Tsujikawa ebad3d4755 Port new ngtcp2 map implementation 2021-05-13 15:01:58 +09:00
Tatsuhiro Tsujikawa cfb47d30a5 Take into account larger frame size for prioritization
Larger frame size just destroys multiplexing and prioritization does
not work.
2019-03-08 00:23:02 +09:00
Tatsuhiro Tsujikawa c2434dfbbc Simplify stream_less 2019-03-04 23:30:03 +09:00
Tatsuhiro Tsujikawa ff200bfcf3 clang-format-5.0 2017-11-23 14:19:12 +09:00
Tatsuhiro Tsujikawa 85a12429ee Eliminate _U_ macro
Instead use (void)VAR for better compiler compatibility.
2017-03-11 18:45:49 +09:00
Tatsuhiro Tsujikawa 19340da8d4 Re-format debug text output 2016-10-14 22:59:05 +09:00
Tatsuhiro Tsujikawa 5e99531b4d clang-format 2016-10-14 22:59:05 +09:00
Tatsuhiro Tsujikawa bef3d47c16 Rename functions and nghttp2_debug.h to move debug macro there 2016-10-14 22:59:05 +09:00
Anders Bakken bc3dc6b765 Add set_nghttp2_debug_callback to take advantage of DEBUGF statements in
when building DEBUGBUILD.
2016-10-13 13:24:26 -07:00
Tatsuhiro Tsujikawa 689d2a1afb Fix compile error with --enable-debug 2016-03-12 21:12:27 +09:00
Tatsuhiro Tsujikawa b7159f80b2 Eliminate the possibility of nghttp2_stream.cycle overflow 2016-02-18 23:56:29 +09:00
Tatsuhiro Tsujikawa 7cc2d22ab5 Fix compile error with gcc 2015-12-08 23:33:26 +09:00
Tatsuhiro Tsujikawa abcdbf0039 Take into account remainder due to integer division when calculating cycle 2015-12-08 23:15:55 +09:00
Tatsuhiro Tsujikawa 4bcc14fc67 Reschedule stream when only weight is changed
Previously, we only updated stream's weight field when only weight was
changed by PRIORITY frame.  If stream is queued, it would be better to
actually reschedule it based on new weight.  This could be especially
useful if weight is increased.
2015-12-07 23:14:22 +09:00
Tatsuhiro Tsujikawa 72f815d535 Update descendant_last_cycle on nghttp2_stream_next_outbound_item
Previously, we updated descendant_last_cycle in
nghttp2_stream_reschedule, which is called after non-zero DATA frame.
But this was not optimal since we still had old descendant_last_cycle,
and new stream was scheduled based on it.  Now descendant_last_cycle
is updated in nghttp2_stream_next_outbound_item, which is called when
stream with highest priority is selected from queue.  And new stream
is scheduled based on it.  This commit also removes 0-reset of
descendant_last_cycle and cycle in nghttp2_stream_reschedule.  This
could help making them lower, so that they are not overflow.  But
there is a pattern that it doesn't work, and we are not sure they are
really useful at this moment.
2015-12-07 22:48:50 +09:00
Tatsuhiro Tsujikawa faad041868 Use seq to break a tie for stream weight
Because of the nature of heap based priority queue, and our compare
function, streams with the same weight and same parent are handled in
the reverse order they pushed to the queue.  To allow stream pushed
earlier to be served first, secondary key "seq" is introduced to break
a tie.  "seq" is monotonically increased integer per parent stream,
and it is assigned to stream when it is pused to the queue, and gets
incremented.
2015-11-25 22:26:56 +09:00
Tatsuhiro Tsujikawa 8f970dec0e Update doc 2015-11-23 21:05:25 +09:00
Tatsuhiro Tsujikawa 4db3828fa6 Reset last_writelen to 0 when stream is removed from tree
When stream is removed from tree, stream is either closed, or its
remote flow control window is depleted.  In the latter case, we
schedule this stream as fast as possible if its remote window gets
positive, since it did not sent anything in its turn.  To achieve
this, reset last_writelen to 0 when stream is removed from tree.
2015-11-20 00:19:17 +09:00
Tatsuhiro Tsujikawa 58d636abdb Revert 918f8cca36
For first scheduling, we might ignore weight.  This is OK since weight
is just a distribution of resource, rather than strict priority
ordering.
2015-11-02 23:38:29 +09:00
Tatsuhiro Tsujikawa cea76226b1 Avoid excessive WINDOW_UPDATE queuing 2015-10-01 01:19:57 +09:00
Tatsuhiro Tsujikawa 170f2a144a Fix warning with gcc 2015-09-23 18:26:02 +09:00
Tatsuhiro Tsujikawa 28fe3e7e89 More warning flags for --enable-werror 2015-09-23 16:49:45 +09:00
Tatsuhiro Tsujikawa 991352d201 Just assign stream->cycle to descendant_last_cycle 2015-09-14 22:20:08 +09:00
Tatsuhiro Tsujikawa 918f8cca36 Honor stream->weight even if stream->last_writelen is 0 2015-09-09 21:20:59 +09:00
Tatsuhiro Tsujikawa 22b39f0337 Revert "last_write_len must not be 0, which makes weight useless"
This reverts commit e260006182.
2015-09-09 21:16:53 +09:00
Tatsuhiro Tsujikawa e260006182 last_write_len must not be 0, which makes weight useless 2015-09-08 02:27:59 +09:00
Tatsuhiro Tsujikawa 4cad48da16 Reset cycle to 0 if stream has only 1 direct descendant 2015-08-29 23:44:58 +09:00
Tatsuhiro Tsujikawa 059280d1a5 Add stream public API
The intention of this stream API is give server application about
stream dependency information, so that it can utilize it for better
scheduling of stream processing.  We have no plan to add object
oriented API based on stream object.
2015-08-19 23:04:06 +09:00
Tatsuhiro Tsujikawa 6a511aef0a Use remove/push combination instead of <= for performance 2015-08-18 00:21:42 +09:00
Tatsuhiro Tsujikawa 5b59e46e2b Rewrite priority handling
We now use priority queue per stream, which contains the stream which
has ready to send a frame, or one of its descendants have a frame to
send.  We maintain invariant that if a stream is queued, then its
ancestors are also queued (except for root).  When we re-schedule
stream after transmission, we re-schedule all ancestors, so that
streams on the other path can get a chance to send.  This is basically
the same mechanism h2o project uses, but there are differences in the
details.
2015-08-17 22:35:50 +09:00
Tatsuhiro Tsujikawa d1e49a196d Remove restriction in regard to number of stream in dependency tree
Previously, the number of stream in one dependency tree (not including
root) is limited to 120.  This is due to the fact that we use
recursive calls to traverse trees.  Now we replaced recursive calls
with loop, we can remove this limitation.  Also now all streams are
descendant of root stream, rather than linked list of individual
subtree root.
2015-08-15 00:53:09 +09:00
Tatsuhiro Tsujikawa f7fa9eb21b Fix sum_norest_weight calculation bug in stream dependency tree 2015-08-14 01:27:50 +09:00
Tatsuhiro Tsujikawa 9e82687cbe Fix compile error with --enable-werror 2015-06-26 23:21:01 +09:00
Tatsuhiro Tsujikawa 660f90e13f Add switch STREAM_DEP_DEBUG to enable runtime validation of depedency tree 2015-06-26 23:02:18 +09:00
Tatsuhiro Tsujikawa bab99af565 Fix unusual control flow in stream_update_dep_set_rest 2015-06-25 22:31:15 +09:00
Tatsuhiro Tsujikawa d6ca95a0c9 Fix sibling's item is not queued when ancestor's item is detached 2015-06-24 22:18:07 +09:00
Tatsuhiro Tsujikawa 1945d0f02a Fix assertion failure in nghttp2_stream.c
This is regression introduced in
46b70c1db8.
2015-06-23 23:04:53 +09:00
Tatsuhiro Tsujikawa 46b70c1db8 Optimize dependency based priority code to Firefox style tree
While this commit optimizes dependency routine to Firefox style tree,
the other use cases (e.g., linear chain) are also improved
dramatically as well.
2015-06-20 22:11:24 +09:00
Tatsuhiro Tsujikawa 43b3640836 Slight code cleanup 2015-06-05 22:06:49 +09:00
Tatsuhiro Tsujikawa f2cf2b625c Replace priority queue with linear queue where possible
After reviewing codebase, only queue for DATA frames requires
priorities.  Other frames can be replaced multiple linear queues.
Replacing priority queue with linear queue allows us to simplify
codebase a bit; for example, now nghttp2_session.next_seq is gone.
2015-04-25 00:56:46 +09:00
Tatsuhiro Tsujikawa 1a12a9b397 Penalize cycle according to effective weight 2015-04-17 21:17:22 +09:00
Tatsuhiro Tsujikawa 57644e0256 Effectively revert 03c4092862
This is not mandated by spec.  Also it may work badly with Firefox
style dependency tree usage.
2015-04-17 21:04:17 +09:00
Tatsuhiro Tsujikawa d4a22edeb3 Don't do fancy stuff yet 2015-04-16 22:58:25 +09:00
Tatsuhiro Tsujikawa 1a8da6caec Update doc 2015-04-16 21:40:39 +09:00
Tatsuhiro Tsujikawa dc335b9025 Improve weight handling a bit 2015-04-16 21:38:13 +09:00
Tatsuhiro Tsujikawa b2bb6f1db1 Fix android NDK build error 2015-04-07 21:25:05 +09:00
Alexis La Goutte 3b6b4ff066 Fix Value stored to 'rv' is never read found by Clang Analyzer 2015-04-01 13:03:22 +02:00