Skip to content
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

Review of WiSH #2

Open
benjchristensen opened this issue Oct 2, 2016 · 7 comments
Open

Review of WiSH #2

benjchristensen opened this issue Oct 2, 2016 · 7 comments

Comments

@benjchristensen
Copy link

After a read-through of WiSH, it looks to me that if I had this for browsers I would use it. For mobile though where I can control my networking stack it’s less clear as a choice as it adds an extra framing layer that is not needed if I can directly access HTTP/2 byte streams like I do with Proxygen right now, or can extend HTTP/2. If I only had standard HTTP libraries though, and WiSH was available over them, I’d use it.

@benjchristensen
Copy link
Author

benjchristensen commented Oct 2, 2016

The extra level of framing is brought up in #1. It many use cases the extra bytes per frame may not matter, though there are some use cases we are pursuing where even the HTTP/2 framing is considered heavy by some compared with MQTT, so it's a topic.

Also, it just feels unnecessary to have yet another level of framing if we can access HTTP/2 streams directly.

In fact, we are currently exploring extending HTTP/2 instead of layering on top of it so that we can eliminate layering altogether: rsocket/rsocket#84 (comment)

So, two questions:

  1. Is there any possibility of pursuing a message oriented solution for HTTP/2 that extends the protocol rather than layers?
  2. If not extend, can the underlying HTTP/2 streams be directly exposed via standardized APIs so that we only need 2 layers of framing (HTTP/2 + application messaging protocol)?

I imagine option 1 is more challenging to convince people of, but option 2 seems straight forward, it's just exposing what already exists in the HTTP/2 spec.

I opened #5 to discuss standardizing the API to achieve option 2.

@tyoshino
Copy link
Member

tyoshino commented Oct 3, 2016

  1. If not extend, can the underlying HTTP/2 streams be directly exposed via standardized APIs so that we only need 2 layers of framing (HTTP/2 + application messaging protocol)?

I think we can expose only some part of HTTP/2 framing via well-designed secure API to the web platform in order to prevent the feature from being abused like how we designed WebSockets. So, I think even (2) leads to designing some general purpose extension of HTTP2 to cover various use cases and it would be similar to WebSocket/HTTP2 discussion.

Even after eliminating the fragmentation feature from the WiSH proposal, having two layers would be critical for the MQTT use case?

@benjchristensen
Copy link
Author

What does the extra level of framing do to provide security that can't be done when exposing the HTTP streams directly?

I'm not experienced in security matters, so can you please explain the implications of security on these choices?

@wenbozhu
Copy link
Contributor

wenbozhu commented Oct 3, 2016

In fact, Node is proposing two APIs for HTTP/2: a low-level session API (access to the wire-level framing) and a high-level HTTP API. OTOH, I don't think Fetch will ever (or should) expose a low-level API.

Reusing the transport-level multiplex framing will cause streams with large messages to block other streams.

The three framing mentioned in #1 are really orthogonal to each other:

  1. multiplexing streams over a "stream oriented" transport like TCP
  2. delivering application-level messages as atomic units
  3. incrementally generating messages over a single stream (FIFO)

Mixing 1) and 2) is actually common and the the HOL blocking may not be a big concern if network is fast or message sizes are kept small by the application. By eliminating 1), CPU efficiency will be improved too due to better caching.

Also, I am guessing that, With a UDP based transport, the implicit cost of 1) is still there because of the max size of UDP packets.

@wenbozhu
Copy link
Contributor

wenbozhu commented Oct 3, 2016

@benjchristensen

Could you clarify "2) If not extend, can the underlying HTTP/2 streams be directly exposed via standardized APIs so that we only need 2 layers of framing (HTTP/2 + application messaging protocol)?"?

Is the goal to have a single framing or to eliminate the framing introduced by something like WiSH because the application has its own protocol/framing? If the latter, we certainly don't expect the application protocol to define any framing on top of WiSH.

@tyoshino
Copy link
Member

tyoshino commented Oct 4, 2016

What does the extra level of framing do to provide security that can't be done when exposing the HTTP streams directly?

When the WebSocket was designed bunch of security related concerns emerged including cross-protocol attack (pretend to be SMTP), cross-origin access (pretend to be cross-origin HTTP), etc. Allowing the web platform to access to lower layer tends to require more care of security concerns.

Given that HTTP2 is basically TLS only and there shouldn't be so many broken intermediaries and servers compared to HTTP/1.1/TCP world, I think issues we need to tackle would be a few. But just layering over HTTP/1.1/HTTP2 would be definitely easier I guess. That's what I wanted to say. I don't have any concrete estimate of actual work needed, yet. Let me investigate more.

@benjchristensen
Copy link
Author

Is the goal to have a single framing or to eliminate the framing introduced by something like WiSH because the application has its own protocol/framing? If the latter, we certainly don't expect the application protocol to define any framing on top of WiSH.

Any non-trivial application protocol is going to effectively end up with its own framing overhead, even if it doesn't need the "Frame length" portion when the transport (such as Wish or WS already has frames). ReactiveSocket makes the frame length optional so it can optimize for transport on protocols that already have frames. Everything else is still needed though as it has its own frame types to achieve its behavior.

More on this in #5 so that we don't replicate that discussion here.

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

No branches or pull requests

3 participants