-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,12 @@ make all | |
make test | ||
``` | ||
|
||
查看中间件请求测试 | ||
|
||
``` | ||
make test -f Makefile2 | ||
``` | ||
|
||
## Results | ||
|
||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |