Simple REST API written in Rust for benchmarking.
# Building crust locally
cargo build --release
# Running crust locally
./target/release/crust --help
# Building crust docker image
sudo docker build -t crust .
# Running crust docker container
sudo docker run -d -p 8080:8080 crust:latest
# Deploying crust on Kubernetes
sudo kubectl apply -f yaml/crust.yamlBenchmarking REST API. It is called crust because it burns!
Usage: crust [OPTIONS]
Options:
-i, --ip-address <IP_ADDRESS> Bind to this IP address [default: 0.0.0.0]
-p, --port <PORT> Bind to this port [default: 8080]
-t, --worker-threads <WORKER_THREADS> Spawns this number of worker threads [default: 1]
-c, --core-affinity <CORE_AFFINITY> Pin worker threads to this set of CPUs
-s, --startup-delay <STARTUP_DELAY> Delays startup by this amount of time in milliseconds
-h, --help Print help
-V, --version Print version
Liveness/readiness check. Always returns 200 OK with body OK.
Prometheus-formatted metrics. Currently exposes a single counter, http_requests_total, incremented on each /burn request.
# HELP http_requests_total Total number of HTTP requests
# TYPE http_requests_total counter
http_requests_total 42
Busy-loops the handler thread for burn milliseconds (floating point) to generate CPU load for benchmarking, then returns 200 OK with body OK.
| Query param | Type | Required | Description |
|---|---|---|---|
burn |
f64 | yes | Duration to burn CPU, in milliseconds |
# Burn for 100ms
curl "http://localhost:8080/burn?burn=100"