forked from klen/py-frameworks-bench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
149 lines (128 loc) · 4 KB
/
Makefile
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#DHOST ?= 192.168.99.100
DHOST ?= 127.0.0.1
VIRTUAL_ENV ?= .env
$(VIRTUAL_ENV)/bin/py.test: $(VIRTUAL_ENV) $(CURDIR)/requirements.txt
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/requirements.txt
@touch $(CURDIR)/requirements.txt
@touch $(VIRTUAL_ENV)/bin/py.test
.PHONY: db
db: $(VIRTUAL_ENV)/bin/py.test
@echo Fill DATABASE
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/python db.py
.PHONY: docker
docker:
docker build -t horneds/pybenchmark $(CURDIR)
RUN ?=
.PHONY: docker-run
docker-run:
docker run --net=host --name=benchmark -d horneds/pybenchmark $(RUN)
test: $(VIRTUAL_ENV)/bin/py.test
$(VIRTUAL_ENV)/bin/py.test -xs tests.py
WRK = wrk -d20s -c200 -t10 --timeout 10s -s scripts/cvs-report.lua
bench: $(VIRTUAL_ENV)
@rm -f $(CURDIR)/results.csv
@echo title,min,50%,75%,90%,99%,99.9%,max,mean,duration,reqs,err,read err,timeouts > $(CURDIR)/results.csv
# # aiohttp
# @make aiohttp OPTS="-p pid -D -w 2"
# @sleep 2
# @make wrk TESTEE=aiohttp
# @kill `cat $(CURDIR)/pid`
# @sleep 5
# # # bottle
# # # @make bottle OPTS="-p pid -D -w 2"
# # # @sleep 2
# # # @make wrk TESTEE=bottle
# # # @kill `cat $(CURDIR)/pid`
# # # @sleep 3
# # wsgi
# @make wsgi OPTS="-p pid -D -w 2"
# @sleep 3
# @make wrk TESTEE=wsgi
# @kill `cat $(CURDIR)/pid`
# @sleep 5
# # django
# @make django OPTS="-p pid -D -w 2"
# @sleep 2
# @make wrk TESTEE=django
# @kill `cat $(CURDIR)/pid`
# @sleep 5
# # falcon
# @make falcon OPTS="-p pid -D -w 2"
# @sleep 2
# @make wrk TESTEE=falcon
# @kill `cat $(CURDIR)/pid`
# @sleep 5
# # pyramid
# # @make pyramid OPTS="-p pid -D -w 2"
# # @sleep 2
# # @make wrk TESTEE=pyramid
# # @kill `cat $(CURDIR)/pid`
# # @sleep 3
# # flask
# @make flask OPTS="-p pid -D -w 2"
# @sleep 2
# @make wrk TESTEE=flask
# @kill `cat $(CURDIR)/pid`
# @sleep 5
# # sanic
# @make sanic OPTS="-p pid -D -w 2"
# @sleep 2
# @make wrk TESTEE=sanic
# @kill `cat $(CURDIR)/pid`
# # It may take several seconds to shootdown...
# @sleep 5
# # tornado
# @make tornado
# @sleep 2
# @make wrk TESTEE=tornado
# @kill `cat $(CURDIR)/pid`
# @sleep 5
# node
@make node
@sleep 2
@make wrk TESTEE=node
@kill `cat $(CURDIR)/pid`
@sleep 5
TESTEE = ""
wrk:
TESTEE=$(TESTEE) $(WRK) http://127.0.0.1:5000/json
TESTEE=$(TESTEE) $(WRK) http://127.0.0.1:5000/remote
TESTEE=$(TESTEE) $(WRK) http://127.0.0.1:5000/complete
OPTS =
aiohttp: $(VIRTUAL_ENV)
@echo $(CURDIR)
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
-k aiohttp.worker.GunicornWebWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/aiohttp
bottle: $(VIRTUAL_ENV)
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
-k meinheld.gmeinheld.MeinheldWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/bottle
django: $(VIRTUAL_ENV)
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
-k meinheld.gmeinheld.MeinheldWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/django
falcon: $(VIRTUAL_ENV)
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
-k meinheld.gmeinheld.MeinheldWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/falcon
flask: $(VIRTUAL_ENV)
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
-k meinheld.gmeinheld.MeinheldWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/flask
pyramid:
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
-k meinheld.gmeinheld.MeinheldWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/pyramid
tornado:
cd frameworks/tornado && $(VIRTUAL_ENV)/bin/python app.py & echo "$$!" > pid
wsgi:
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
-k meinheld.gmeinheld.MeinheldWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/wsgi
sanic:
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
-k sanic.worker.GunicornWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/sanic
node:
cd frameworks/node-api && node index.js & echo "$$!" > pid