Skip to content

Instantly share code, notes, and snippets.

@ashi009
Created May 22, 2014 03:09
Show Gist options
  • Save ashi009/294f125ade6f7a9e11cb to your computer and use it in GitHub Desktop.
Save ashi009/294f125ade6f7a9e11cb to your computer and use it in GitHub Desktop.
express crc32 benchmark
all:
@./run 128 res-size
@./run 512 res-size
@./run 1024 res-size
@./run 2048 res-size
@./run 4096 res-size
@./run 16384 res-size
@./run 65536 res-size
@echo
.PHONY: all
var http = require('http');
var express = require('..');
var app = express();
// number of middleware
var n = parseInt(process.env.BUFFER_SIZE || '100', 10);
console.log(' response size: %sB', n);
var body = new Buffer(n);
app.use(function(req, res, next){
res.send(body);
});
app.listen(3333);
#!/usr/bin/env bash
echo
BUFFER_SIZE=$1 node $2 &
pid=$!
sleep 2
wrk 'http://localhost:3333/' \
-d 10 \
-c 50 \
-t 8 \
| grep 'Requests/sec' \
| awk '{ print " " $2 }'
kill $pid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment