dgrr / http2

HTTP/2 implementation for fasthttp
Apache License 2.0
208 stars 36 forks source link

Framing layer (with priorization, weight and dependency) #4

Closed dgrr closed 2 years ago

dgrr commented 3 years ago

Section

I am not sure about this one. Implementing this would imply that:

  1. We have a coroutine per Stream (that would be ok, but we need to thing about overhead).
  2. Only one coroutine reads from the connection and sends the frames read to the particular Stream (if any).
  3. Communication using channels between Streams and main coroutine (the coroutine that reads from the conn).
  4. Another coroutine to write to the conn. Here we can just have 2 channels, one for reading and another one for writing, but it's ok.

My concern about this is: The code will look so ugly and it will just create more edge cases, more goroutine overhead, etc... Also, how does priorization and dependency of streams work? WTF, I don't want to have a graph of Streams.

If someone has any idea, you are welcome to comment down here. The only point I am thinking about I'd be ok to implement is a coroutine per Stream. Streams doesn't live that long... But using a goroutine pool can do the work. Also, it would speed up quite a lot. It's already fast and is currently working synchronously, think async!

dgrr commented 3 years ago

Everything implemented. The only thing left is the priorization, etc... I don't know how to do that in the current structure

dgrr commented 2 years ago

I think it's not possible in the current framework. If someone requires it, please let me know here.