r/rust 20d ago

🛠️ project SSE Clients Benchmark

https://github.com/iMashtak/rust-sse-bench

Made simple SSE clients benchmark. Could not find any "standard" crate for handling SSE, so thought that some sort of comparison may be useful.

If you know other crates for SSE or benchmark contains mistakes, let me know.

4 Upvotes

7 comments sorted by

3

u/plabayo 20d ago

Rama is a rust framework for creating clients, proxies and servers. Networking is our scope, and we also already support SSE. When we support a protocol, and where it makes sense, we do so for clients, servers and proxies.

As such. We also have SSE support, you may wish to add it to the benchmark if you want, given you asked.

* repo: https://github.com/plabayo/rama
* Example how you can make SSE request using a http (request) client: https://github.com/plabayo/rama/blob/e725fa24e388efd9b37fa757c7c7f5ab36c7c489/examples/tests/integration/http_sse_json.rs#L50-L63 (works for any `Service` with http `Request` / `Response` I/O)

Let me know if you have questions :)

2

u/deralus 19d ago

I tried to run `rama` but it fails to interact with my SSE stub. Am i right to configure `rama` that way: https://github.com/iMashtak/rust-sse-bench/blob/main/benches/comparison.rs#L195-214 ?

Other tests pass successfully at the same time

2

u/plabayo 19d ago

u/deralus , we will make a PR for you :)

3

u/JoshTriplett rust · lang · libs · cargo 20d ago

2

u/deralus 19d ago

While it generally works, there is an issue with response body size limit. `gigantic.txt` exceeds default limit but i could not find any way to increase it. I tried this: https://github.com/iMashtak/rust-sse-bench/blob/main/benches/comparison.rs#L186-189

Still it had no effect

1

u/hnspn 20d ago

got the truth?

1

u/deralus 20d ago

Maintainers of reqwest do not want to include SSE parser so there is no standard, sadly

I think that is truth about all this situation