Which language would you recommend for the back-end development?
Even though it's "old", but back in July (2020) we could replicate this behavior.
One main aspect of "why" we are swithcing to rust is that our project needs to handle large amounts of data (think > 15Gb in RAM). When you try to work with large data structures within RAM, the GC of golang goes a little nuts. There's many different memory issues that we found, for example, when we put a larger load on our project, there's allocations happening, but Golang won't deallocate or release the memory to the OS unless the load goes down.
But if you don't have to work with large data structures and need a speedy multithreaded solution, then you can definately go with golang.
I would also like to point out that it's not very accurate to say that Rust has moderate C++ flavor. It has C flavor with some "differences" when it comes to variables and their lifetimes as well as some different minor flavors of other languages. For example, it has channels, which work in a very similar way as in golang. It has stream (functional) programming to be done as easy as with Java. The biggest issue with Rust is that there's no well established libraries to work with and sometimes you get major incompatibilities or the issue when you have to so many different 3rd party libraries, that it becomes unconfortable to manage.
But in my experience, I wouldn't pick Go. Having the GC makes it easier to just get things done than with Rust, but it doesn't take long to feel like all the logic is lost to the noise of error handling. It also seems easy to miss closing resources with defer since there's nothing like .NET's IDisposable to look for.
If you need a large variety of battle-tested libraries, I wouldn't choose either though. Python, C#, Java, and C++ are better choices there.
Between Go and Rust, Go wins on popularity and amount of libraries, compilation speed (not an issue for me really, but some people care more about that) and its easy to get someone who knows it. Rust wins on quality of libraries, tooling and the code you'll produce.
Rust gets dependency management right, and the language is actually worth learning. Golang is meh at best.
You will need to spend some time building yourself a web framework though, if you want one, as existing ones are very basic. That's a serious issue with Rust atm.
Go in my mind is a replacement for java/c#
Rust is a replacement for c/c++ Do you see that much development for backend web services in C or C++?
The choice of a programming language (without considering specific details of the application) is very subjective with a low signal to noise ratio. What looks aesthetic or ergonomic for others will most likely not apply to you.
For most practical applications things like the runtime, library ecosystem and other factors become more important and just "Rust or Golang for backend development?" isn't very helpful.
I work in a very large C/C++ organization and the build concern over our 1000s of libraries is a giant chore to do well in a DEVOPS context. GO is so much better. RUST is routinely seen worse than GO here. Compilation is slow but anecdotally dependency management in RUST is orders of 10 better that C/C++ and comparable to GO.
There are a few stories in HN where cloud providers, big data types have been burned by GC. But it's not routine. Their ability to find and fix root cause required in-depth diagnostics. If your system is complex your tooling better have good support there. GO definitely does.
Here's what I say: if you are I/O bound GO is just fine. GO has great libraries for all manner of HTML/socket work. It works well with protobuf, compression, REST APIs, UUIDs. Its SQL library is great.
If you are low latency bound or need latency in a narrow range you'd better do a POC in GO and RUST and make an informed choice. There's plenty of GO programmers and fewer good RUST programmers.
There are more HN posts from people learning RUST reporting the borrow aspect of RUST is tough to learn and tougher to do right. RUST kind of memory management isn't routinely found in other languages.
RUST is meant to be a better C++. It's meant to excel in the niche area of system like libraries by yielding C/C++ performance without memory C/C++ memory problems which are perhaps the largest security attack area. RUST will not remove all data races. It reduces them - which is good - but do not over interpret. In this sense RUST is smart: they've picked a good market, and their tools make good sense there.
C++ is not necessarily the go-to for bare metal programming. So neither would RUST be. Most of the Linux kernel is C not C++, for example. We know that calling C-libraries from a non-C language is routine. To RUST? Not sure. To C++? That's a harder ask but you're probably not the only one who's doing it - at least that.
If you're handling big data structures with loads of allocations and deallocations and complicated algorithms, Rust might be the language for you. The language shines and the lack of a GC shines at those workloads. The same is true for batched workloads that can be processed in parallel, because the restrictions Rust puts on object access makes it excellent to make assumptions about data access and ownership with little or no performance wasted on the framework around the threading library.
As much as I like Rust and projects like Rocket.rs, I'm just not sure if the ecosystem is mature enough for it to be used for a production backend for web services. I'd wait a year or two for the Rust frameworks to gain more features and more quality of life improvements before actually using it.
If yes, Rust: no GC, consider the rayon crate for concurrency. Higher learning curve, ecosystem may not be as mature for certain areas yet (outside of web assembly).
If no, Go: lower learning curve, runtime-managed concurrency, more ecosystem maturity for most enterprise software tasks.
Feel free to recommend any Go/Rust framework. Also why do you prefer that language?
Rust is a more general purpose language, and has been designed from the start to work well with existing C-style libraries.
Both have their place, but you asked about a backend. Go shines there.
Coming from Java/Python background, Go feels like a fresh breeze. You can easily get things done with Go.
Go is garbage collected, Rust is not. Go is compact, Rust has lots of functional programming bells and whistles like algebraic data types. Go compiles quickly, Rust takes a while. Go has first class support for concurrency, Rust does not.
Roll with whichever you like. For me, as a side-language, it's Go, because I already enjoy and use Haskell, and I feel like Go contrasts more with Haskell. If I didn't know Haskell, I'd probably choose Rust.
If it wasn't for a side-language, but was for a specific project, I'd choose on the basis of available libraries.
These languages - I would throw Swift in there as well - are “apples and oranges” and shouldn’t really be compared. Depending on your use case, they all have different merits over each other.
To actually make a worthwhile recommendation, you’d have to elaborate on what you mean by backend service. RESTful? gRPC? Something else? When it comes to the first two scenarios, I think Go enables more rapid development and has a stronger library ecosystem.
Anyway, speed-wise, go will get you further faster.
Job-wise, go will get you way mor opportunities.
Performance-wise, rust will be always faster, no way around that.
Future-proof-wise, go, no contest.
Popularity-wise, go, hands down.
tl;dr rust is very niche, low-level, performance-oriented language and should be used in such use-cases. Anything else, Go will do better.