3 ms·
Hey I'm not a member of the rust team so take my comment with a huge chunk of salt, but this is changing very soon. The rust community seems to be slowly but s
by hardwaresofton 8y ago
Hey I'm not a member of the rust team so take my comment with a huge chunk of salt, but this is changing very soon.
The rust community seems to be slowly but steadily working through a bunch of bigger use cases (all in the open as well, so you can see exactly what they're doing and why). For networking use cases, see projects like tokio[0] and hyper[1] to see how the community is moving (here's an awesome talk on it[2]). To me, it looks like the rust community is actually trying really hard to build things modularly and slowly from the start, taking tons of time to "measure twice cut once".
All that said, building networked systems in Rust is definitely extremely usable right now (and in many cases without nightly, I don't turn it on for any of my projects) -- maybe you won't find a gopher-server crate (rust's packaging mechanism) but for regular HTTP/HTTP2 you're going to find a lot of production-ready software (rocket[3], actix-web[4], tower-web[5]). I'd love to be pointed to some recent post where someone spelled out their issues writing some basic HTTP/HTTPS REST-ish backend servers (which I think is what the majority of people are writing/maintaining in their day jobs).
Side note (I'd love for someone to correct me), but generally when people want "performant" multithreaded network services, I take that to mean they want the combination of all system cores utilized and IO treated asynchronously -- in my mind this is basically all it takes, everything else is application/solution-space level optimization (parse your JSON a little quicker, maybe use a better data structure, do more things concurrently, etc). Rust has both of these things (system threads, libraries with async support) -- for example async/await syntax is landing soon, and from what I know the state of the art has progressed in this manner: callbacks->deferred/promises/futures->async/await -- rust is already 2/3 and async/await support is landing soon. And on top of all this -- rust is going to make parallelism & concurrency safer -- this is huge because while it might have been easy to `#include <pthread>` in C/C++, it sure isn't/wasn't easy to write correct concurrent/parallel code without the support of a runtime.
[0]: https://tokio.rs/ https://tokio.rs/
[1]: https://hyper.rs/ https://hyper.rs/
[2]: https://www.youtube.com/watch?v=4QZ0-vIIFug https://www.youtube.com/watch?v=4QZ0-vIIFug
[3]: https://rocket.rs/ https://rocket.rs/
[4]: https://actix.rs/ https://actix.rs/
[5]: https://github.com/carllerche/tower-web https://github.com/carllerche/tower-web
- pjmlp 8y ago> I take that to mean they want the combination of all system cores utilized and IO treated asynchronously -- in my mind this is basically all it takes, everything else is application/solution-space level optimization How are Rust SQL drivers for distributed computing with Oracle, DB2, SQL Server?
- hardwaresofton 8y agoUhhh I'm mega out of my depth on that subject -- I don't know. If the systems you're discussing can kick off the distributed computing by just receiving SQL, then there are definitely crates to do that in rust -- that's just a matter of sending SQL on the wire in the right format, right? I can talk about some SQL drivers though -- I've used `postgres` (postgres), `rusqlite` (sqlite), `r2d2` (connection pooling) and others to great success building some relatively small codebases. For a more pre-baked approach `diesel` is the ORM that everyone is generally on if that's your speed. Just in case I misinterpreted the question -- were you meaning to say that distributed computing using Oracle/DB2/SQL Server are examples of contradictions to my statement of "everything else" being "application/solution-space level optimization"?
- pjmlp 8y agoTwo basic examples: - calling PL/SQL on an Oracle RAC cluster using distributed transactions at driver level. - define data structures where the driver does the mapping into PL/SQL User Defined Types.
- hardwaresofton 8y agoAhh OK -- so the first thing is basically whether there's a good oracle driver for rust that supports that feature... I don't know/don't think so? I searched "oracle" (https://crates.io/search?q=oracle https://crates.io/search?q=oracle) and found a bunch of drivers, but I'm not sure which of them support distributed transactions explicitly. rust-oracle is listed on the shared programming interface page though (https://oracle.github.io/odpi https://oracle.github.io/odpi), so maybe it's close if not already possible. I doubt the second one more though -- how many languages even have an oracle driver with integration that tight to begin with? I struggle to find drivers that map PL/SQL user defined types to in-language types (even with something simple like enums)...