Skip to content
rusthacks.dev
Topic

Concurrency

Threads, channels, locks, atomics and Tokio, with a bias towards the bug you will hit at 3am.

Flat illustration for the post “Fan Out and Fan In Work Pipelines in Rust Services Design”, composed around threads.
Architecture

Fan Out and Fan In Work Pipelines in Rust Services Design

Split work across a bounded pool of workers and merge the results: a producer, bounded channels for backpressure, N workers, a collector and clean shutdown. A Tokio pipeline with ordering, errors and cancellation handled.

5 min read
Flat illustration for the post “Circuit Breakers and Bulkheads in Rust Service Clients”, composed around architecture.
Architecture

Circuit Breakers and Bulkheads in Rust Service Clients

Stop one failing dependency from taking the whole service down. A circuit breaker fails fast after repeated errors and probes for recovery; a bulkhead caps concurrency per dependency. Implement both with Tokio.

5 min read
Flat illustration for the post “Debugging Async Backtraces and Task Dumps in Tokio”, composed around async.
Tooling

Debugging Async Backtraces and Task Dumps in Tokio

A hung async service has no useful thread backtrace. Tokio task dumps capture the await stack of every task. Enable tokio_unstable and taskdump, trigger a dump from a signal or endpoint, and read where each task is parked.

4 min read
Flat illustration for the post “Rust Error Recursion in an Async Fn Requires Boxing”, composed around threads.
Concurrency

Rust Error Recursion in an Async Fn Requires Boxing

A recursive async fn has an infinitely sized future, so the compiler asks for indirection. Return a boxed future with Box::pin, or use the async-recursion crate, and prefer a loop when you can.

7 min read

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.