-
Hi, Stakker looks fascinating! I'm wondering if you have planned to publish benchmarks that compare Stakker with other options. I think, that could help with the marketing of the crate (if the results are good... 😄). Also: Is my assumption correct, that basically everything has to be re-written for Stakker (HTTP servers/clients, etc.)? Or would it be easy to reuse crates that are written on top of "pure" Mio, for example? |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 12 replies
-
Yes, I did some benchmarking but it isn't complete enough to publish yet. I tested doing a calculation that stresses both data and instruction cache and then passing the resulting value to the next actor, and so on around a ring of actors. The number of actors and the length of the data-part and instruction-part of the calculation could be varied. Also the number of rings running in parallel could be varied. I tested Stakker against a solution based on
So this backs up what I claimed in the blog post. However trying to nail down theses figures more precisely gets difficult, as there is variation up/down with small changes to the code, I guess due to cache effects. I would need to do a lot of runs and plot them to see the trend. Also it would be better to also test against other channel implementations such as flume and the channel implementation inside Tokio. Regarding interfacing with the existing ecosystem, there is no ready-made "glue" available as yet. If a crate was written to just do protocol and not talk directly to an I/O layer (i.e. not hardcoded to one solution) then interfacing to it should be relatively easy. (It's possible that some crates even if coded for Tokio for example may also provide another interface which just does protocol, which we could interface to.) If something is coded to talk directly to mio then that's probably just as unhelpful as it being hardcoded to talk to anything else, although it depends on the exact way they interface (maybe they could be adapted more easily). It may be possible someday to support running external async/await code, i.e. act as an executor. Then maybe we can pull in some of the ecosystem that way. It needs investigating. Otherwise you can run an existing executor (Tokio/async_std/etc) in another thread and communicate to the Stakker thread with channels or something. Whether this is efficient enough depends on how central that aspect is to your application. If you or anyone else has better ideas about how to (with relatively small effort) bring in some part of the ecosystem, then I'd be interested to hear. |
Beta Was this translation helpful? Give feedback.
-
@uazu: Very interesting – thanks for the detailed answer!
I'd be interested in benchmarks of an "end product". An HTTP/WebSocket client/server, for example.
Would tungstenite (a Websocket client/server crate) be enough decopeled for They write:
I think, a list of crates that work well together with Very excited to see how |
Beta Was this translation helpful? Give feedback.
-
That sounds great.
Yes, unfortunately, they do not really recommend to use
There are some WebSocket load testing tools and services, it seems (however, I don't have any experience with them). Here is a repo with benchmark code and instructions for different programming languages (including Rust). There wasn't an update in a few years, but this might still be useful. Here is a WebSocket load testing tool that's written in Rust. I found other projects written in Python and JavaScript, for example, but I assume that they would be too slow (on the other hand, ideally a benchmark would be distributed, so these tools might still be useful). Here is an article about stress testing WebSockets with artillery (JavaScript/node.js).
Do you mean, what normally is implemented via WebSockets? The most common use-case is probably to maintain a connection between as web browser and an HTTP server. HotWire and Phoenix LiveView send HTML (and other data) from the server to the client, for example. Database/API connections should also be pretty common. Appolo's GraphQL server would be an example for that. Besides that, I've also seen people mentioning that WebSockets are used for game servers and even stock trading APIs.
Yes, on the web, the client would send a protocol upgrade request to the HTTP server (which can be load balanced, as you wrote).
So, I'd love to do this. Unfortunately, I'm pretty busy with other projects, as well. I also doubt I'd be the ideal person to do it (I don't have a background in system programming. I do mostly web development). That being said, if nobody beats me to it, I might give it a try, when I have more time. Especially, when I have an actual use-case for a high-performance WebSocket server (one project I'm interested in, would need this). One problem, regarding my potential use-case (in regard to These components all use Something that would be useful for people like me (without a background in system programming), would be a short guide, that explains what to look out for, when searching for crates that play nicely with
Out of curiosity, for what do you use |
Beta Was this translation helpful? Give feedback.
-
Ah, okay. I'm not really sure, there are many different use cases. So I'd use a combination of small/medium/big requests/responses in the data formats that are supported (text and binary), and measure maximum throughput. But I'm not really experienced with benchmarking/stress testing.
You are most likely right here.
I like the second approach. At some point, traits for runtime agnostic crates will be available, so this seems like the most future-oriented approach (I'm sure, you are aware of all this).
That's fantastic, thanks!
Nice! For a few projects I'm working on, I'm interested in a TUI, so I'll have a look at your TUI crate, when this time comes. |
Beta Was this translation helpful? Give feedback.
-
Okay, thanks. Are you planning to add more functionality, when you are ready to work on your editor, or should the crate remain low-level? |
Beta Was this translation helpful? Give feedback.
-
Thanks for answering all my questions! I'll be on the lookout for a project that |
Beta Was this translation helpful? Give feedback.
-
Hi @uazu :) In another thread you wrote "I'm not sure how to promote [Stakker] further when so much energy and enthusiasm is devoted to other runtimes". I think, showing a benefit in performance or resource usage (if there is one) would help a lot to promote Stakker (because that is probably the most common reason why someone would want to use something else than async Rust). Unfortunately, I still hadn't time to play with Stakker, or to even create a small benchmark (however, one of my current projects could probably benefit from it, so maybe I can build some components with Stakker). Recently, there was a post on r/rust that linked to some benchmarks of gRPC implementations. The results show, that the Rust implementation (based on Tonic and Tokio) is significantly faster than all other implementations in single-thread mode. However, the multi-threaded version is less performant than other implementations (still fast, but slower than several other implementations). I'm wondering if such a benchmark would be a good fit to see if Stakker is more performant than alternatives. I'd image that, if a Stakker-based implementations turns out to be significantly faster than other Rust-based implementations, that would convince some people in the community to have a look at Stakker (which I strongly feel, would deserve such attention). However, I don't know much about gRPC, or how much work it would be to build 'stakker-grpc' and implement the benchmark code (it seems, there are some crates that could be used or adapted). Besides that, 'stakker-grpc' itself would probably be an asset in itself. gRPC is something I'm probably going to look at for my current project. So maybe, if nobody else wants to do it, I could give it a try. Something else, that would help, I believe, would be a community-curated list of crates that can be used with Stakker. For example, I was looking for an HTTP client that can be used with Stakker, and found mio_httpc, which looks promising. |
Beta Was this translation helpful? Give feedback.
-
Thank you for the detailed description :) This shouldn't be too difficult to implement. My plan now is to first reasearch a bit how to properly benchmark network applications, after which I'll ask the Rust community for feedback (and how they would implement such a benchmark). Then I'll start to build implementations, and ask for a review of the code (here and on r/rust or the message board). The last step would be to run the benchmark and publish it. I'll start with Tokio and Stakker, however I'm also interested in other runtimes (e.g. Mio on its own, message-io, Glommio, and a multithreaded version), which I might implement as well, if the above doesn't take too much effort. Does this all make sense? I basically only have time on some evenings, so this project could take some time to complete. |
Beta Was this translation helpful? Give feedback.
Yes, I did some benchmarking but it isn't complete enough to publish yet. I tested doing a calculation that stresses both data and instruction cache and then passing the resulting value to the next actor, and so on around a ring of actors. The number of actors and the length of the data-part and instruction-part of the calculation could be varied. Also the number of rings running in parallel could be varied. I tested Stakker against a solution based on
Rc<RefCell>
and also actors running in separate threads connected with crossbeam channels. The conclusions so far are:Rc<RefCell>
once you've added code to handle…