Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@deweerdt
Copy link
Member

@deweerdt deweerdt commented Dec 6, 2018

This PR adds logic that has H2O record the priority information of the last 10 streams that were closed.

This plays better with Chrome's chain of exclusive dependencies that might be re-ordered, because it makes it more likely that we'll find a stream in the even of a re-ordering. I've tested the code against https://github.com/pmeenan/http2priorities and that gave consistently good results in webpagetest (100 successive good runs).

@kazuho
Copy link
Member

kazuho commented Dec 6, 2018

To confirm, you succeeded in reproducing the issue and the issue when away with this change?

Sounds fantastic to me.

@deweerdt
Copy link
Member Author

deweerdt commented Dec 6, 2018

To confirm, you succeeded in reproducing the issue and the issue when away with this change?

That's right, here's a run with master serving files off the disk that shows the issue before the fix:
https://www.webpagetest.org/result/181204_PW_2c05a1efceba6ef5771b28db79fa79e2/9/details/#waterfall_view_step1

I then ran 10 times the test which runs 9 page loads, and none of those had an issue.

Copy link
Member

@kazuho kazuho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the PR and the approach looks fine to me.

I've left comments while reading the code. I do not think we need to address all the issues now, but please let me submit these so that it does not get lost.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add break here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is an unrelated change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming the variable to next_slot? IMO that is the purpose of this index.

It might also make sense to add a doc-comment to streams that states that it is a ring buffer with next insertion point being next_slot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would appreciate it if you could use size_t because the values is used for indexing an array.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice that in get_parent_stream_id function of lib/http2/connection.c, we might refer to h2o_http2_stream_t::stream_id that is relative to the address of sched_node.

Considering that, it might make more sense to simply keep a pointer to h2o_http2_stream_t that has all the values disposed of with the exception being stream_id and _refs.scheduler, rather than retaining a pointer to sched_node as well as separately keeping stream_id.

Note however that we also agree that it's a bit of waste to retain h2o_http2_stream_t even after the stream is closed. FWIW, I think we could use something like 94536be to move just the scheduling node to a different location.

The way of adjusting this structure depends on if and how we might fix the issue.

@deweerdt deweerdt force-pushed the set-priorities-old-streams branch from cbd305e to 25702ce Compare December 7, 2018 22:28
`h2o_http2_scheduler_openref_t` , so that closed streams can expose
their stream id as well
@deweerdt
Copy link
Member Author

deweerdt commented Dec 7, 2018

Thank you for writing h2o_http2_scheduler_relocate. It does simplify the code significantly. I believe e56120f addresses all your comments so far.
It introduces a h2o_http2_closed_stream_t struct and adds a get_stream_id callback in order to get the stream from a h2o_http2_scheduler_node_t

@kazuho
Copy link
Member

kazuho commented Dec 10, 2018

Thank you for the changes. It seems like we are going to fix this issue properly :-)

I would appreciate it if you could consider deweerdt#2. Thank you in advance.

Use subtyping instead of adding a callback
@deweerdt
Copy link
Member Author

@kazuho merged deweerdt#2, thanks!

@kazuho kazuho merged commit b33e9a9 into h2o:master Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants