Hi everyone,
I’ve been building Stampede, a load testing library for Phoenix apps. Load tests are plain Elixir modules, and it speaks the Channels and LiveView protocols itself, so you don’t have to rebuild joins, refs, heartbeats or the LiveView CSRF dance by hand like you do with k6 or Tsung.
A LiveView test looks like this:
defmodule MyApp.Load.Counter do
use Stampede.Scenario
@impl true
def options do
[vus: 500, duration: [minute: 1], thresholds: [{"live.event", p95: 100}]]
end
@impl true
def run(_vu) do
{:ok, view} = Stampede.LiveView.connect("http://localhost:4000/counter")
{:ok, _reply} = Stampede.LiveView.click(view, "inc")
Process.sleep(1_000)
end
end
$ mix stampede.run loadtest/counter.exs --html report.html
connect/2 loads the page like a browser, keeps cookies, follows redirects and joins with the page’s tokens. From there you can click, change, submit, patch and navigate.
What else is in there:
- Phoenix Channels: join, push, cast, await broadcasts, both serializers
- HTTP with keep-alive, and plain WebSockets
- VUs with stages, or a fixed arrival rate
- checks and thresholds, so
mix stampede.runcan fail CI - percentiles within 1%, a per-second timeline, JSON and HTML reports
mix stampede.compareto catch regressions between two runs- splitting one test across several nodes
On my laptop, with the server on the same machine, it held 3,000 LiveView users, and 6,000 channel users split over 3 nodes, without errors.
the API can still change, which is why I’m posting now. If you try it against your app, I’d really like to hear what breaks or what’s missing.
Hex: stampede | Hex
Docs: https://stampede.hexdocs.pm
GitHub:


















