Interactive Rust microservice for computing array statistics and histograms
High-performance Rust service using Axum + Tokio + Rayon.
Computes sum, mean, median, min, max, and optional histogram of numeric arrays.
- Clone the repository:
git clone https://github.com/smart-developer1791/rust-compute-microservice.git
cd rust-compute-microservice
- Build and run:
cargo run --release
- Open in your browser:
| Path | Method | Description |
|---|---|---|
/compute-stats |
POST | Compute statistics and optional histogram |
/ |
GET | HTML UI to test and visualize computations |
/health |
GET | Plain-text health check |
/healthz |
GET | JSON readiness check |
{
"values": [1,2,3,4,5,6,7,8,9,10],
"bins": 5
}
curl -X POST http://localhost:8080/compute-stats \
-H "Content-Type: application/json" \
-d "{\"values\":[1,2,3,4,5,6,7,8,9,10],\"bins\":5}"
- Compute statistics: sum, mean, median, min, max
- Optional histogram with configurable bins
- Parallel computation using Rayon
- Interactive HTML UI at
/ - Health and readiness endpoints for containerized environments
- Rust 1.72 – system programming language
- Axum 0.7 – web framework for async HTTP services
- Tokio 1.0 – asynchronous runtime
- Rayon 1.11 – data parallelism library
- Serde / Serde JSON – serialization and deserialization
- Tracy / Tracing-subscriber – structured logging