News for hackers. Stuff that matters.
Re:A taste of pavex, an upcoming Rust web framework by vbezhenar on Saturday December 31, 2022 @08:24AM (#34196230)
Is there popular Rust web server which uses just threads with no async stuff?
Re:A taste of pavex, an upcoming Rust web framework by stevedonovan on Saturday December 31, 2022 @08:34AM (#34196303)
I suppose async web servers is the poster child of async, and drove a lot of the development. However, then _everything_ went async, adding the cognitive overhead of dealing with Rust async throughout the ecosystem, whether needed or not.

In short, it still feels like a leaky abstraction: marvelous to look at working code, but errors (both compile and run-time) expose the underlying machinery underneath the syntactical sugar.

This is probably heresy, but as a former Rust dev I'm enjoying web-services in Go more these days.

Re:A taste of pavex, an upcoming Rust web framework by afavour on Saturday December 31, 2022 @11:20AM (#34197811)
I love Rust but I kind of agree. It’s really, really rare for a web service to need the low-level stuff Rust provides. A garbage collected is going to be just fine.
Re:A taste of pavex, an upcoming Rust web framework by nbittich on Saturday December 31, 2022 @11:48AM (#34198169)
I hated async for months. Refused to touch it. Recently I tried it again. It (seems) way better now. Just avoid weird libraries like diesel & rocket, and everything works just as expected. I even wrote some generic code with async and surprisingly it works without me having to get a phd in type theory to please the compiler.
Re:A taste of pavex, an upcoming Rust web framework by marcosdumay on Saturday December 31, 2022 @12:57PM (#34198872)
And if you want to make it async anyway, take a look at the abstractions a garbage collected language like Haskell can get you. (But well, the ones Go provide are probably more than enough already.)

Rust was not made for web development, and the fact that people keep creating frameworks and keep deciding they are good only shows how bad the usual practices are around the web.

Re:A taste of pavex, an upcoming Rust web framework by brundolf on Saturday December 31, 2022 @11:37AM (#34198045)
Tbf Go was purpose-built for web services, while Rust was more a "oh I bet we could do that too, and they'd be crazy fast and stable!" The language hasn't bent itself to fit that shape like Go has, so it's not surprising the latter is a smoother experience overall
Re:A taste of pavex, an upcoming Rust web framework by virtualritz on Saturday December 31, 2022 @01:31PM (#34199224)
There are other applications, e.g. trading, where async is a godsent (monitoring hundreds of financial instrument for changes) but any sort of GC is prohibitive.

And where you also need the fine grained control that Rust provides.

E.g. halting all async tasks immediately while keeping a single core free to execute a trade as fast a possible.

Re:A taste of pavex, an upcoming Rust web framework by mfashby on Saturday December 31, 2022 @08:33AM (#34196295)
Rocket.rs I believe
Re:A taste of pavex, an upcoming Rust web framework by DoubleFree on Saturday December 31, 2022 @08:38AM (#34196326)
Rocket is moving towards async as well
Re:A taste of pavex, an upcoming Rust web framework by 0x457 on Saturday December 31, 2022 @01:27PM (#34199183)
Rocket is not moving anywhere right now. 0.5 supposed to be async, but it's delayed more than a year because maintainer doesn't have time.
Re:A taste of pavex, an upcoming Rust web framework by Grimburger on Saturday December 31, 2022 @07:17PM (#34202174)
You don't have to use async in Rocket v0.5.
Re:A taste of pavex, an upcoming Rust web framework by cytzol on Saturday December 31, 2022 @08:50AM (#34196394)
Re:A taste of pavex, an upcoming Rust web framework by Waterluvian on Saturday December 31, 2022 @11:07AM (#34197662)
Is a thread per request scalable? Aren’t most of those threads just waiting for I/O? I guess thousands of concurrent requests via thousands of threads isn’t a big deal.
Re:A taste of pavex, an upcoming Rust web framework by marcosdumay on Saturday December 31, 2022 @12:59PM (#34198888)
You mean at the application layer?

There never was any problem scaling things at the application layer. You can use almost any architecture there without issues. All the bottlenecks are elsewhere.

Re:A taste of pavex, an upcoming Rust web framework by vbezhenar on Saturday December 31, 2022 @03:58PM (#34200674)
It's reasonably scalable. Operating system can deal with thousands of sleeping threads just fine. And I don't need more than that (on a single machine anyway).
Re:A taste of pavex, an upcoming Rust web framework by aseipp on Saturday December 31, 2022 @04:47PM (#34201108)
Yes, you can run absolutely massive systems with very high throughput and high concurrency using only OS threads and "normal" synchronous programming, if done correctly. However it's generally a pain in the ass because most languages often have their own threading models that may have their own limitations or interaction-with-the-OS quirks, while in C or C++ you're typically on your own for like, all your dependencies including trivialities like thread pools and stuff. And all newer languages tend to instead design their I/O ecosystems around asynchronous stuff. So you have to choose your poison. But handling massive systems always requires a bit of special care anyway.

You will often encounter many other bottlenecks that hold your system back. There are other concerns like latency and utilization to care about. But assuming a purely "compute/IO" driven data plane, yes, you can scale synchronous APIs with threading quite far.

Re:A taste of pavex, an upcoming Rust web framework by jokethrowaway on Saturday December 31, 2022 @07:44PM (#34202355)
async is pretty efficient, no reason to ditch that.

It's just a pool of threads being used on demand.

The source of "complexity" according to the author is in using traits to make sure the middlewares are defined correctly.