Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

executable file 32 lines (27 sloc) 0.689 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
#!/usr/bin/env bash

NODE_ENV=production node ./support/app &
pid=$!

bench() {
  ab -n 5000 -c 50 -k -q http://127.0.0.1:8000$1 \
    | grep "Requests per" \
    | cut -d ' ' -f 7 \
    | xargs echo "$2:"
}

bench_conditional() {
  ab -n 5000 -c 50 -H "If-None-Match: $3" -k -q http://127.0.0.1:8000$1 \
    | grep "Requests per" \
    | cut -d ' ' -f 7 \
    | xargs echo "$2:"
}

sleep .5
bench / "Hello World"
bench /blog "Mounted Hello World"
bench /blog/admin "Mounted 2 Hello World"
bench /middleware "Middleware"
bench /match "Router"
bench /render "Render"
bench /json "JSON tiny"
bench /json/15 "JSON small"
bench /json/50 "JSON medium"
bench /json/150 "JSON large"

kill -9 $pid
Something went wrong with that request. Please try again.