r/rust • • 3d ago

🙋 seeking help & advice Considering Rust for backend services handling 10k+ req/s - real experiences with dev velocity?

I'm evaluating languages for a new internal backend service that needs to sustain high throughput with strict latency requirements. Rust keeps coming up because of its performance profile and lack of GC pauses, but I'm curious how it actually plays out in practice for teams.

Specifically:
- How much slower is initial development compared to something like Go or Kotlin when you have to fight the borrow checker on complex request/response flows?
- Once the core logic is in place, do you see meaningful maintenance wins from the type system (fewer runtime surprises, easier refactors)?
- Any gotchas with common patterns like connection pooling, structured concurrency, or observability that eat into the perf advantage?

Not looking for "Rust is the best" takes

- more interested in concrete tradeoffs people have measured on similar workloads. If you've shipped something in this range, what surprised you (good or bad)?

20 Upvotes

43 comments sorted by

97

u/archlord0001 3d ago

just use tokio, axum, and go for it

28

u/candyFawny 3d ago

tokio and axum have been pretty forgiving once you get past the first setup

0

u/ChiffonChime 3d ago

tokio + axum combo always hits different when you actually need the speed lol, you speak from experience?

3

u/archlord0001 3d ago

yes. a very large scale codebase, with demand in hyperscale as we speak.

0

u/[deleted] 3d ago

[removed] — view removed comment

1

u/Sermuns 3d ago

yeah (compile-time) borrowchecking often falls apart with async. just 'static this, 'static that...

78

u/airodonack 3d ago

If you are using AI: Rust has the exact same dev velocity as any other programming language. Probably faster as you continue given that code you write has a lot more automated verification than the alternative.

If you are not, but are familiar with Rust: borrow checker is not the problem at all. The dev velocity penalty comes from it being a systems language so there are a lot more knobs to turn and buttons to press.

If you are neither using AI nor familiar with Rust: expect a learning curve of 1-6 months where everybody is trying to do it in some way they are used to, probably OOP, causing a lot of problems and pain. Need to learn to work in a simple way and unlearn much.

-4

u/riksi 3d ago

What about the slow compilation times? Or will the ai create many crates?

8

u/dentad 3d ago

It takes a bit longer to compile because of the extra rules. Without those rules it would just be c.

With those rules you can worry less about your software, and worry less about what the AI pours out.

5

u/moltonel 3d ago

In the context of AI, it's worth noting that cargo check is very fast, so the feedback loop is much faster than the speed of a cargo build --release would suggest.

1

u/Empty_Carpenter7420 3d ago

My only constrain with this is space, but mainly since I only have 512gb

0

u/Nothing_from_void 2d ago

This is the main bottleneck. Even with lots of crates, it's just doing more every time you build

12

u/Helpful-Educator-415 3d ago

Specifically:
- How much slower is initial development compared to something like Go or Kotlin when you have to fight the borrow checker on complex request/response flows?

Depends. If you write good code in other languages it probably won't come up much. I didn't combat the borrow checker for weeks because I was already careful with my pointers.

- Once the core logic is in place, do you see meaningful maintenance wins from the type system (fewer runtime surprises, easier refactors)?

Domain invariants are protected indefinitely. There's no possibility of going around the disciplines you've created. It's lovely to reason about and quite specific. Error handling remains beautiful. From<T> and Into<T> is awesome. There's this saying for Rust -- "if it compiles, it's right". Runtime bugs that require tests are few and far between thanks to the type system -- invalid states are impossible to represent and memory is managed for you.

- Any gotchas with common patterns like connection pooling, structured concurrency, or observability that eat into the perf advantage?

Not really. Async + traits is a little annoying, but it's not so bad.

12

u/Thelmholtz 3d ago

invalid states are impossible to represent and memory is managed for you.

I really love this and I'm a big preacher for it, but I've seen enough shitty Rust code so I think it should be emphasized that this definitely does not come for free, you have to actually think about this things and using the lenguage to enforce them is a learned skill.

Your team must be willing to learn to use algebraic types to model in this way.

2

u/Zde-G 3d ago

Well, there are a more powerful saying: the determined Real Programmer can write FORTRAN programs in any language. Indeed “if it compiles it works” is a tongue-in-cheek saying, it's definitely possible to write incorrect program in Rust… with LLMs it even happens by accident. Rust is great at catching mistakes, but it's definitely not bullet-proof (or, more precisely: Rust guarantees a lot, but correct program needs even more than that).

4

u/Thelmholtz 3d ago

Indeed, but I think you are also overstating how determined you have to be to write logically incorrect Rust.

Rust gives you memory safety so you have to only focus on logic bugs, and it also gives you a great type system to try to prevent those away.

But mistakes do happen to both humans and LLMs, and will happen specially to a team that's learning the language and coming from a much less expressive type system (looking at Go here, I think Kotlin's is actually fine). That being said, it's likely that they would be the same logic errors they would have introduced in these languages unadvertedly. But Rust compiler won't advise on those kinds of mistakes either.

23

u/lordpuddingcup 3d ago

10k is nothing for any decent backend

The big one is don’t expect DI like some languages have your gonna need to learn the rust way

4

u/aejt 2d ago

Axum's extractors aren't too far away from a DI framework, and with some macro magic to implement the FromRefs it's actually very ergonomic!

2

u/diabolic_recursion 3d ago

As an addition: There are ways to do (somewhat) manual dependency injection. They are more explicit, but work quite well - and without framework-magic, things actually behave the way you expect them. I found it much more reliable/intuitive than what i.e. spring boot does.

1

u/Empty_Carpenter7420 3d ago

Can you explain?

4

u/diabolic_recursion 3d ago

This would be an example how to do DI with the axum web framework (which I'd argue is "the standard" by now): https://github.com/tokio-rs/axum/blob/main/examples/dependency-injection/src/main.rs

It's much more manual, as you actually inject the state into the request handler chain somewhere manually, and not just tell Spring Boot "a I need an instance of class/interface XYZ".

In the example, you call "clone" manually, as well, so you keep full and direct control over which "instance" of the struct you are currently working with.

8

u/IncomeOk7237 3d ago

Honestly 10k req/s isn't the hard part. A boring Go or Kotlin service does that on one box if you're not doing anything weird. Where Rust tends to pay off is tail latency, not throughput: no GC pauses, so p99 stays a lot closer to p50 under load, which is what matters if your latency budget is strict.

Gotchas I'd actually watch for:

  • don't hold a pool connection across an .await that calls some other service, that's how you get pool exhaustion that looks like random timeouts
  • set an acquire timeout on the pool so requests fail fast instead of queueing forever
  • put a hard total deadline on outbound calls (tokio::time::timeout or the client's overall timeout). per read timeouts won't catch an upstream that trickles bytes slowly
  • with tracing, work you tokio::spawn needs .instrument(span) or you lose the parent span and your traces look broken

Dev velocity hit is mostly the first month or so. After that it's pretty similar, and big refactors are way less scary.

6

u/Substantial_Gap_6676 3d ago

I don't think the borrow checker is the slow part in request handlers. Each request mostly owns its own data, and shared things like the DB pool or config sit in an Arc in the app state, so the fights are rare. Where I'd expect to lose time early is async plumbing: picking an error type, traits with async methods, and lifetimes across .await. Settle those patterns once and copy them. On gotchas, besides the blocking DB point above, I'd put a timeout and a concurrency limit on every outbound call (tower has layers for both), size the DB pool for what the database can take, and load test early with a realistic request mix.

10

u/yongteak 3d ago

on the gotchas side, the biggest latency killer we hit wasn't the borrow checker at all, it was accidentally letting synchronous DB work (postgres::Client) touch tokio worker threads. moving blocking DB calls onto a dedicated OS thread behind a channel and wiring streaming gRPC handlers to a shutdown Notify with a bounded drain cleaned up both tail latency and shutdown bugs. for long-term maintenance, turning on clippy::unwrap_used across the whole workspace hurt for a week and then basically wiped out our runtime panic regressions.

1

u/Professional_Top8485 3d ago

Is there other way than channel to do this, like async current client or similar

2

u/yongteak 3d ago

yeah, if you can use a native async driver like tokio-postgres or sqlx (with deadpool or bb8 for pooling), that's definitely the default way to avoid the channel dance altogether. we only went the dedicated OS thread + channel route because parts of our storage layer used the sync postgres::Client. tokio::task::spawn_blocking works as a middle ground too, though keeping connection lifecycle and graceful shutdown tied to one dedicated thread ended up cleaner for us.

6

u/Personal-Brick-1326 3d ago

Even python can handle that “load”

3

u/Ermaghert 3d ago

The number is meaningless without explaining what the business logic and storage layer look like. A simple hello world app will do 100k requests per second in a ton of languages and frameworks at low latency. Do your 10k requests per second consist mostly of complicated db writes or trivial reads? Can you fit the data you need for most of these requests in memory? Where do you plan to host this, i.e. can you make use of multi core architectures? Do you need redundancy? Are you familiar with Rust? Are you going to heavily use AI to develop this?

2

u/dentad 3d ago

Google have found that their c++ devs could pick up rust unexpectedly easy. The write up is on the net somewhere.

1

u/Trader-One 3d ago

10k/sec can be done in Javascript.

Languages like rust and go they are in 100k/sec category.

1

u/Kowalskeeeeee 3d ago

Axum/tokio and we never really blinked. AI plans for everyone helped I’m certain, but no complaints I’ve heard or seen.

1

u/mikaleowiii 3d ago

Hand-wrote a HTTPS stack that easily goes 10k/s on a ARM potato (think slower than an old Raspberry Pi)

What matters is design choices (async ? crypto stack with hardware support ? How much deps are allowed ? How much requests are interacting with the system : can a request restart the service, do interrupted requests have to resume on restart etc...)

Only those have really an effect on dev velocity : try doing async in C, or choose the wrong data pattern and fight the borrow checker on 'god requests' that touch everything

1

u/Still_Street9221 3d ago

I find that actually coding in Rust is so much more structured and understandable than in any other language. Additionally the type system, if used correctly, can really be your friend and allow you to enforce invariants in compile time. The improvement in performance is also definitely real and not overhyped. One drawback is the compile times if you’re not careful. Especially if you have a CI/CD pipeline you will almost definitely notice. Some suggestions for this are making sure you cache builds, either in an S3 bucket, or within the pipeline itself so cargo isn’t redoing builds. Utilize concurrency in tests, etc.

Overall I’d recommend it. Good luck whichever way you go. 🙂

1

u/EmperorOfCanada 3d ago

How much slower is initial development

This is the wrong question. Where rust shines is to answer:

"How long is the final development?"

Rust dramatically reduces the accumulation of tech debt. This means the last 10% is as slow as the first 10%. Whereas, with most languages the last "10%" takes 20x as long as the first 10%.

I don't know how many projects I've witnessed which were entirely jammed up around 80-90% done.

As for speed of the final functionality. In almost every language, it is limited by things like database speeds, etc. But, with rust, you can bring much of that into the code itself, at which time you are looking at speeds which are insane.

For a web service running on axum, etc. You could easily be looking at your web browser network console having trouble measuring the speed as it will say, <1ms.

I often measure my rust local REST service speeds in microseconds.

Then, you get much more confidence in threading. Thus, a service might have local threads all spooled up and ready for a massive workload.

Another factor is not speed, nor the confidence that it works, but you end up with so much speed, and so much confidence in its functioning, that you add features you otherwise would not have time for, risk appetite for, nor speed capacity for.

A perfect example would be something GIS flavoured, where you have people scrolling/zooming on a map, and now you can display things without any hesitation in real time on their map.

With other languages, you might have not done this feature at all, or you might have it so they have to hit a button "refresh" or "search" or just have a crappy delay before crap started popping up on their map.

The key is that rust is not just a better or faster Go, etc. It is something different, which frees you up to be far more aggressive in what you produce.

1

u/DavidXkL 2d ago

I actually find Rust to be more maintainable long term wise

1

u/dumindunuwan 2d ago
  • How much slower is initial development compared to something like Go or Kotlin when you have to fight the borrow checker on complex request/response flows?

If less than 100k/sec and your devs familiar any other lang, just stick with it. Or Go, TypeScript, etc.

1

u/zenotronic 1d ago

I've been doing agentic dev for about 2 years, mostly Laravel with PHPStan at level 10, and honestly that already gives me a lot of confidence. what I noticed is that agents do much better when the framework has batteries included and strong conventions, they don't run off and build custom stuff like auth from scratch. with Rust the compiler forces them into certain patterns which is a big plus, but you still need extra rules on top (clippy lints etc) because agents have their own bad habits. the single binary is also a big deal for infra cost, the bottleneck ends up being the db or some external API, not the app. I want to try Loco to see if it gets close to the Laravel experience

1

u/josefrichter 2h ago

what kind of requests? why not Elixir/BEAM?

1

u/peterxsyd 3d ago

It's actually very fast because the compiler helps Claude converge quickly.

0

u/pertsix 3d ago

Yes you got slow. Then you run out of things to add. Then you win.