Book 1 · Lesson 1.5

Why Rust for infrastructure

  • Compare Rust services to Python/Node for pipeline workloads
  • Read a minimal Axum handler structure
  • Name millipede services written in Rust

Prerequisites: 1.3

Millipede pipeline services — ingestion, analyzer, gateway — are Rust/Axum. The llm-worker is Python. Why split?

Comparison

Rust (Axum)Python (llm-worker)
StrengthPredictable latency, safety, Kafka I/OML ecosystem, rapid enrichment logic
MemoryOwnership, no GC pauses in hot pathGC OK for batch consumer
DeploySingle static binary + mTLSvenv + container

Minimal Axum handler shape

async fn health() -> Json<HealthResponse> {
    Json(HealthResponse { redis: "connected".into() })
}

async fn github_webhook(body: Json<WebhookBody>) -> Result<Json<Accepted>, StatusCode> {
    // validate → publish Kafka → return 200
}

See services/ingestion/src/main.rs — real webhook at :8081.

Error handling philosophy

Rust forces you to handle Result — failed Kafka publish becomes a typed error, not a silent None.

Teach-back prompt

Which millipede service would you not rewrite in Rust first, and why?

Read an Axum handler

Lesson 1.5 check

1. millipede LLM enrichment runs in…