Mini Actor framework visualized in a night coffee shop: Actor, Addr, Inbox, Supervisor

Build Your Own Mini Actor Framework: Run Concurrency Like a Coffee Shop

Using a coffee shop metaphor, build a practical mini Actor framework in Rust covering Addr, spawn, supervise, a registry, and message passing.

August 21, 2025 · 6 min · 1137 words · Rexai Programming

Rust + Axum Async Microservice Guide: Job Queue, Retries, and Graceful Shutdown

If async tasks keep waking you up at 3 a.m., this guide is for you. We’ll build a resilient microservice with Rust + Axum that processes jobs reliably, scales well, and shuts down gracefully. The mental model: a busy coffee shop An HTTP request is like a customer placing an order. You shouldn’t block the cashier until the coffee is brewed. Instead: accept the order, hand it to the kitchen, and move on to the next customer. Our job queue is the order slip; workers are the baristas. ...

August 17, 2025 · 4 min · 797 words · Rexai Programming
The difference between Tokio tasks and OS threads

Stop treating tokio::spawn as a thread! I launched 1000 tasks in 2 seconds and the system stayed calm

Follow Rexai Programming on WeChat to learn Rust the easy way. Forget the heavy “thread” mental model from your OS class. Today, I’ll show you a delightful trick about Tokio. You think tokio::spawn creates a thread? Nope. It gives you something smarter, lighter, and frankly a little sneaky: the ability to harness massive concurrency at a shockingly low cost. This is one of Rust’s secret weapons in backend development. Ready? Let’s reveal the trick. ...

August 11, 2025 · 4 min · 818 words · Rexai Programming
Rust async is compiled into a state machine and driven by Future, poll, and Waker

Rust Async State Machine, Unmasked: How Future, poll, and Waker Really Work

Your Rust async code is a “liar”—and I’m going to strip its state machine down to the bones. Have you ever written an async function, happily called it, and then… the program just ended with nothing happening? You stare at the screen: Where did my code go? Where’s my println!? Did I just run emptiness? Don’t panic. You’re not alone. Welcome to the world of Rust async, where the first rule is: what you see isn’t necessarily what’s happening. ...

August 10, 2025 · 4 min · 770 words · Rexai Programming

Rust Async Unveiled: The Secret to Making Code 'Slack Off' While Doubling Efficiency!

Rust Async Unveiled: The Secret to Making Code ‘Slack Off’ While Doubling Efficiency! Hello, future Rust master! Today we’re diving into a fascinating topic: asynchronous programming (Async). You might have encountered it in JavaScript or Python, thinking of it as a behind-the-scenes hero silently handling everything. But in Rust, this “hero” operates completely differently. It doesn’t play “magic tricks” - everything is laid out in the open, both explicit and efficient, and after compilation, it’s almost “zero-cost”! ...

January 15, 2024 · 6 min · 1184 words · Rexai Programming