Skip to content
Myr

bench

This file

Path

support/bench

32 lines · 689 bytes

Last changed by

mergedTJ Holowaychukbefore adoption809e0b8

History of this file

Take it

added `make benchmark` backTJ Holowaychukbefore adoption85fc586

lines 1–2why, one step back
1#!/usr/bin/env bash
2

render benchTJ Holowaychukbefore adoptiona169cc7

line 3why, one step back
3NODE_ENV=production node ./support/app &

added `make benchmark` backTJ Holowaychukbefore adoption85fc586

lines 4–6why, one step back
4pid=$!
56bench() {

more benchmarksTJ Holowaychukbefore adoption25fe426

lines 7–10why, one step back
7 ab -n 5000 -c 50 -k -q http://127.0.0.1:8000$1 \
8 | grep "Requests per" \9 | cut -d ' ' -f 7 \10 | xargs echo "$2:"

added `make benchmark` backTJ Holowaychukbefore adoption85fc586

lines 11–12why, one step back
11}
12

Added conditional-GET support to res.send()TJ Holowaychukbefore adoptiona58e3de

lines 13–19why, one step back
13bench_conditional() {
14 ab -n 5000 -c 50 -H "If-None-Match: $3" -k -q http://127.0.0.1:8000$1 \15 | grep "Requests per" \16 | cut -d ' ' -f 7 \17 | xargs echo "$2:"18}19

added `make benchmark` backTJ Holowaychukbefore adoption85fc586

lines 20–21why, one step back
20sleep .5
21bench / "Hello World"

mounted hw benchTJ Holowaychukbefore adoptionc33f1ba

line 22why, one step back
22bench /blog "Mounted Hello World"

more benchmarksTJ Holowaychukbefore adoptionb042339

line 23why, one step back
23bench /blog/admin "Mounted 2 Hello World"

added `make benchmark` backTJ Holowaychukbefore adoption85fc586

line 24why, one step back
24bench /middleware "Middleware"

more benchmarksTJ Holowaychukbefore adoption25fe426

line 25why, one step back
25bench /match "Router"

render benchTJ Holowaychukbefore adoptiona169cc7

line 26why, one step back
26bench /render "Render"

more benchmarksTJ Holowaychukbefore adoption430699c

lines 27–30why, one step back
27bench /json "JSON tiny"
28bench /json/15 "JSON small"29bench /json/50 "JSON medium"30bench /json/150 "JSON large"

added `make benchmark` backTJ Holowaychukbefore adoption85fc586

lines 31–32why, one step back
31
32kill -9 $pid