v2ray-core icon indicating copy to clipboard operation
v2ray-core copied to clipboard

Quic new stream allocation mode

Open yuhan6665 opened this issue 3 years ago • 4 comments

Currently this is how Quic works: client muxing all tcp and udp traffic through a single session, when there are more than 32 running streams in the session, the next stream request will fail and open with a new session (port). Imagine lineup the session from left to right:

 |
 |  |
 |  |  |

As the streams finishes, we still open stream from the left, original session. So the base session will always be there and new sessions on the right come and go. However, either due to QOS or bugs in Quic implementation, the traffic "wear out" the base session. It will become slower and in the end not receiving any data from server side. I couldn't figure out a solution for this problem at the moment, as a workaround:

       |  |
    |  |  |
 |  |  |

I came up with this new stream allocation mode, that it will never open new streams in the old sessions, but only from current or new session from right. The keeplive config is turned off from server and client side. This way old sessions will natually close and new sessions keep generating. Note the frequency of new session is still controlled by the server side. Server can assign a large max stream limit. In this case the new allocation mode will be similar to the current mode.

yuhan6665 avatar Jan 28 '22 22:01 yuhan6665

Is it possible to add an option for this? I don't have the ability to estimate the consequence of such change, but I will be comfortable with merging this if user can turn this behavior off once QUIC have this bug fixed.

xiaokangwang avatar Jan 29 '22 18:01 xiaokangwang

@xiaokangwang thanks for your review. However I would prefer simple design here without adding an option. Because the new mode is clearly better with the current session behavior. If we can figure out the problem with the base session, we can easily revert this commit. It is also easy to test single session, this number can be increased: https://github.com/v2fly/v2ray-core/blob/1df432218eaa71b8c3ec3de0af9308399a90fd56/transport/internet/quic/hub.go#L108

yuhan6665 avatar Jan 30 '22 01:01 yuhan6665

This design is simple enough, direct modification is acceptable.

kslr avatar Apr 06 '22 05:04 kslr

It has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Oct 27 '22 02:10 github-actions[bot]

It has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] avatar Mar 01 '23 02:03 github-actions[bot]