67 lines
2.5 KiB
Nix
67 lines
2.5 KiB
Nix
# urus-bench shell.nix
|
|
#
|
|
# Assumes you already have a working rust toolchain (cargo, rustc) and
|
|
# elixir/erlang in your environment. This shell adds:
|
|
#
|
|
# - the load generators (wrk, wrk2)
|
|
# - process introspection (pidstat, taskset)
|
|
# - small conveniences (jq, sqlite CLI for poking at the WAL'd DBs)
|
|
# - C toolchain bits so `rusqlite` (bundled SQLite) and `sqlx` compile
|
|
#
|
|
# Drop into the workspace root and run `nix-shell`. Then:
|
|
# cargo build --release
|
|
# ./runner.sh urus-mem s1
|
|
#
|
|
# For cowboy-server you'll use your existing rebar3/elixir setup; this
|
|
# shell deliberately doesn't pin a beam toolchain since you have one.
|
|
|
|
{ pkgs ? import <nixpkgs> {} }:
|
|
|
|
pkgs.mkShell {
|
|
name = "urus-bench";
|
|
|
|
# buildInputs vs nativeBuildInputs: for a developer shell the
|
|
# distinction barely matters; either works. Keeping everything in
|
|
# `packages` since that's the recommended modern form.
|
|
packages = with pkgs; [
|
|
# Load generators (the whole point of this shell).
|
|
wrk # closed-loop, used as the saturation probe
|
|
wrk2 # constant-rate, latency-honest measurement
|
|
|
|
# Runner deps.
|
|
sysstat # provides pidstat for CPU sampling
|
|
util-linux # provides taskset for CPU pinning
|
|
jq # pretty-prints result.json (runner falls back without it)
|
|
curl # the prepopulate step uses curl --config (-K)
|
|
gawk # explicit; busybox awk lacks some printf bits we use
|
|
|
|
# SQLite tooling — handy for inspecting WAL'd DBs between runs.
|
|
# rusqlite/sqlx bring their own embedded sqlite so this is *not* a
|
|
# build dep, just a CLI for poking around.
|
|
sqlite
|
|
|
|
# C toolchain — rusqlite's `bundled` feature compiles sqlite from
|
|
# source, and sqlx's macros also need a working cc. Without these
|
|
# the rust build fails on a fresh nix shell.
|
|
pkg-config
|
|
gcc
|
|
];
|
|
|
|
# Environment hints. Nothing strictly required, but these defaults
|
|
# match what runner.sh already expects when invoked without env
|
|
# overrides, so a fresh shell `just works` for `./runner.sh ...`.
|
|
BEARER = "test-token-aaaaaaaaaaaaaaaaaaaa";
|
|
|
|
shellHook = ''
|
|
echo "urus-bench shell:"
|
|
echo " wrk $(wrk --version 2>&1 | head -1 || echo missing)"
|
|
echo " wrk2 $(wrk2 --version 2>&1 | head -1 || echo missing)"
|
|
echo " pidstat $(command -v pidstat || echo missing)"
|
|
echo " taskset $(command -v taskset || echo missing)"
|
|
echo " cargo $(command -v cargo || echo 'NOT FOUND — expected on host')"
|
|
echo
|
|
echo "Build: cargo build --release"
|
|
echo "Run: ./runner.sh urus-mem s1"
|
|
'';
|
|
}
|