Streaming vs Buffering interfaces #20
calebschoepp
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As we implement WASI Observe one of the fundamental decisions we'll need to make is whether the interface is designed for buffering or streaming telemetry data1. In this discussion I will explain what I mean by these two terms; cover the pros and cons of each approach; and suggest what approach I think we should take. Ultimately the goal of this discussion is two-fold: help build shared vocabulary for us to use and solicit feedback on which approach we should use.
I've already spilt a decent amount of ink on this topic in a PR here where I was doing exploratory work on what a tracing interface could look like. This discussion can be viewed as a refinement of that work using new terminology that I think is more clear. Reading the original PR isn't necessary context to understand this, but may be helpful.
Most of my examples will be focused on the tracing use case, because that is what I've done the most work on. However, I think everything here should extrapolate to metrics and logging.
Buffering
In a buffering interface it is the responsibility of the guest to collect and buffer telemetry data before sending the completed data over to the host. There are two obvious interfaces that could be used for a buffering interface. We'll explore them one at a time.
Buffering over WASI HTTP
One option is having the developer send telemetry data over HTTP like they would with a normal non-WebAssembly application. In this case the developer would instrument their application as they normally would and they would use a standard HTTP exporter pointing at their collector. They would need to make sure the host gives the guest access to the collector HTTP endpoint.
Pros
Cons
Buffering over a custom interface
Another option is sending the telemetry data over a custom WIT interface rather than WASI HTTP. The developer would still buffer telemetry data in the application like above, but would use a custom "WASI exporter" in their application. This "WASI exporter" would be backed by a custom WIT interface that might look something like this:
Pros
Cons
Streaming
Rather than having the guest buffer telemetry data before sending it to the host, we can have it immediately stream the data to the host with a WIT interface that might look something like:
A developer would instrument their application with the standard libraries, but they would not specify an exporter. Rather the library itself would be backed by this WIT and thus always streaming telemetry state to the host.
Pros
Cons
Conclusion
What follows is my opinion...
TL;DR Buffering over WASI HTTP is a good stop gap until we can land streaming support.
I think we should standardize around the streaming interface primarily because it will play nice with existing auto instrumentation traces. Secondarily because it keeps needless complexity out of the guest.
Given that buffering over WASI HTTP mostly/kind of works today I think it can act as a stop gap until we can land streaming support. In the long term some developers may continue using this approach if they don't want to adopt a new WIT interface, but this would not be my recommended approach given its downsides.
Footnotes
It turns out this is probably an important question for lots of WASI interfaces, but for obvious reason I'm going to keep this scoped to just WASI Observe. ↩
Beta Was this translation helpful? Give feedback.
All reactions