Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crust

Simple REST API written in Rust for benchmarking.

Setup

# 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.yaml

Usage

Benchmarking 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

REST API

GET /healthy

Liveness/readiness check. Always returns 200 OK with body OK.

GET /metrics

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

GET /burn?burn=<milliseconds>

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

Example:

# Burn for 100ms
curl "http://localhost:8080/burn?burn=100"

About

Benchmarking REST API written in Rust. (Called crust because it burns)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages