Skip to content

Commit

Permalink
refact
Browse files Browse the repository at this point in the history
  • Loading branch information
i5ting committed Apr 20, 2016
1 parent 174ea0f commit aba4686
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 0 deletions.
75 changes: 75 additions & 0 deletions Makefile2
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
all: clean test

test: prepare koa-1 koa-2 koa-2-async express

report:
@cd logs
@wrk_scan
@echo 'merge logs complete'

prepare:
@cd koa2 && npm install
@cd ..
@cd other && npm install
@cd ..
@echo 'prepare complete'


version:
@node -v
@npm -v
@echo

koa-1:
@echo 'benchmark koa-1'
@./run2 1 other/koa1.js
@./run2 5 other/koa1.js
@./run2 10 other/koa1.js
@./run2 15 other/koa1.js
@./run2 20 other/koa1.js
@./run2 30 other/koa1.js
@./run2 50 other/koa1.js
@./run2 100 other/koa1.js
@echo

koa-2:
@echo 'benchmark koa-2'
@./run2 1 koa2/koa2.js
@./run2 5 koa2/koa2.js
@./run2 10 koa2/koa2.js
@./run2 15 koa2/koa2.js
@./run2 20 koa2/koa2.js
@./run2 30 koa2/koa2.js
@./run2 50 koa2/koa2.js
@./run2 100 koa2/koa2.js
@echo

koa-2-async:
@echo 'benchmark koa-2-async'
@./run2 1 koa2/koa2-async-compile.js
@./run2 5 koa2/koa2-async-compile.js
@./run2 10 koa2/koa2-async-compile.js
@./run2 15 koa2/koa2-async-compile.js
@./run2 20 koa2/koa2-async-compile.js
@./run2 30 koa2/koa2-async-compile.js
@./run2 50 koa2/koa2-async-compile.js
@./run2 100 koa2/koa2-async-compile.js
@echo

express:
@echo 'benchmark express'
@./run2 1 other/express.js
@./run2 5 other/express.js
@./run2 10 other/express.js
@./run2 15 other/express.js
@./run2 20 other/express.js
@./run2 30 other/express.js
@./run2 50 other/express.js
@./run2 100 other/express.js
@echo

clean:
@rm -rf koa2/node_modules
@rm -rf other/node_modules

.PHONY: prepare test
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ make all
make test
```

查看中间件请求测试

```
make test -f Makefile2
```

## Results

```
Expand Down
16 changes: 16 additions & 0 deletions run2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

echo
MW=$1 node $2 &
pid=$!

sleep 2

wrk 'http://localhost:3333' \
-d 3 \
-c 50 \
-t 8 \
| grep 'Requests/sec' \
| awk '{ print " " $2 }'

kill $pid

0 comments on commit aba4686

Please sign in to comment.