Complete Guide to Rust WebSocket Actor Implementation

Hands-On Code! Perfect WebSocket + Actor System Implementation - I Pulled Another All-Nighter

From zero to hero WebSocket transport layer implementation, every line of code has a story, performance so good it makes you wonder if the compiler is cheating

January 10, 2025 · 9 min · 1744 words · Rexai Programming
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 async microservices: rate limiting, backpressure, batching and middleware

Rust Async Microservices, Tamed: Rate Limiting, Backpressure, Batching, and Middleware

Bold claim up front: stability is not “slow.” Stability is making “fast” happen in an orderly way. With the gates placed at the right spots, even a flood can be channeled into rivers. Think about a subway during Monday rush hour. Entry turnstiles regulate inflow, platforms enforce headcount, trains add extra cars, and the PA system orchestrates everything. That is exactly what microservices must do under high concurrency. Your Rust service needs the same four gates: rate limiting, backpressure, batching, and a smart brain of middleware. ...

August 20, 2025 · 6 min · 1130 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
Complete implementation and best practices for Rust Axum graceful shutdown

Rust Axum Graceful Shutdown, The Ultimate Guide: Fix the pitfall 99% of engineers hit

Rust Axum Graceful Shutdown, The Ultimate Guide: Fix the pitfall 99% of engineers hit Follow Moshou Coding on WeChat to learn Rust the easy way. Do these production nightmares look familiar? You reboot the server and lose user data. DB connections fail and transactions get rolled back. WebSocket links drop and the UX craters. The root cause is a detail 99% of developers overlook — Rust Axum graceful shutdown. Let’s make it practical and friendly while staying production‑grade. ...

August 17, 2025 · 3 min · 449 words · Rexai Programming
Build a high‑performance Web server with Rust and Axum

Rust + Axum, from zero to hero: build a high‑performance Web server the LEGO way

You’ve heard the rumors: Rust is blazing fast and memory‑safe, but writing backend services feels intimidating. What if it could feel like building with LEGO — intuitive, composable, and fun? Enter Axum, a modern Web framework built by the Tokio team. In this tutorial you’ll: Understand Axum’s core concepts: Router, handlers, extractors Work with path parameters, query parameters, and JSON Add shared state with Arc<Mutex<T>> Install middleware such as structured tracing Step 1: Add dependencies axum = "0.7" tokio = { version = "1", features = ["full"] } Or via CLI: ...

August 14, 2025 · 2 min · 404 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