out_of_protocol
9 months ago
Why providing non-compressed version at all? This is new protocol, no need for backwards compatibility. Dictionary may be baked into protocol itself, being fixed for specific version. E.g. protocol v1 uses that fixed v1 dictionary. Useful for replaying stored events on both sides
ericvolp12
9 months ago
Jetstream isn't an official change to the Protocol, it's an optimization I made for my own services that I realized a lot of other devs would appreciate. The major driving force behind it was both the bandwidth savings but also making the Firehose a lot easier to use for devs that aren't familiar with AT Proto and MSTs. Jetstream is a much more approachable way for people to dip their toe into my favorite part of AT Proto: the public event stream.
out_of_protocol
9 months ago
As I understand article, there are new API (unofficial , for now)
- Jetstream(1) (no compression) and
- Jetstream(2) (zstd compression).
And my comment means (1) not really needed, except some specific scenarios
ericvolp12
9 months ago
It's impossible to use the compressed version of the stream without using a client that has the baked-in ZSTD dictionary. This is a usability issue for folks using languages without a Jetstream client who just want to consume the websocket as JSON. It also makes things like using websocat and unix pipes to build some kind of automation a lot harder (though probably not impossible).
FWIW the default mode is uncompressed unless the client explicitly requests compression with a custom header. I tried using per-message-deflate but the support for it in the websocket libraries I was using was very poor and it has the same problem as streaming compression in terms of CPU usage on the Jetstream server.
slantedview
9 months ago
> It also makes things like using websocat and unix pipes to build some kind of automation a lot harder
Would anybody realistically be using those tools with this volume of data, for anything but testing?
stonogo
9 months ago
It's not that much data. Certainly nothing zstdcat can't handle.
jacoblambda
9 months ago
A non-compressed version is almost certainly cheaper for anything local (ex self-hosting your own services that consume the firehose on the same machine or for testing).
There's not really a good reason to do compression if the stream is just going to be consumed locally. Instead you can skip that step and broadcast over memory to the other local services.
out_of_protocol
9 months ago
It could be a flag, normally disabled. Also, i'm not sure about "cheaper" side, since disk ops are not free, maybe uncompressing zstd IS cheaper than writing, reading huge blobs from disk, exchanging info between apps
cowsandmilk
9 months ago
This isn’t compression, they are throwing features of the original stream out.
user
9 months ago
out_of_protocol
9 months ago
We're discussing here compiled output, plain json and the same json but zstd-compressed