forked from klen/py-frameworks-bench
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
191 lines (169 loc) · 6.25 KB
/
Makefile
File metadata and controls
191 lines (169 loc) · 6.25 KB
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
DHOST ?= 192.168.99.100
VIRTUAL_ENV ?= .env
$(VIRTUAL_ENV): $(CURDIR)/frameworks/aiohttp/requirements.txt $(CURDIR)/frameworks/bottle/requirements.txt $(CURDIR)/frameworks/django/requirements.txt $(CURDIR)/frameworks/falcon/requirements.txt $(CURDIR)/frameworks/flask/requirements.txt $(CURDIR)/frameworks/muffin/requirements.txt $(CURDIR)/frameworks/pyramid/requirements.txt $(CURDIR)/frameworks/tornado/requirements.txt $(CURDIR)/frameworks/wheezy/requirements.txt $(CURDIR)/frameworks/weppy/requirements.txt
@[ -d $(VIRTUAL_ENV) ] || virtualenv $(VIRTUAL_ENV) --python=python3
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/frameworks/aiohttp/requirements.txt
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/frameworks/bottle/requirements.txt
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/frameworks/django/requirements.txt
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/frameworks/falcon/requirements.txt
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/frameworks/flask/requirements.txt
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/frameworks/muffin/requirements.txt
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/frameworks/pyramid/requirements.txt
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/frameworks/tornado/requirements.txt
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/frameworks/twisted/requirements.txt
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/frameworks/wheezy/requirements.txt
@$(VIRTUAL_ENV)/bin/pip install -r $(CURDIR)/frameworks/weppy/requirements.txt
@touch $(CURDIR)/frameworks
@touch $(VIRTUAL_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: lab
lab:
@echo Start docker container
@docker run -p 80:80 -p 5432:5432 --name pybenchmark -d horneds/pybenchmark && sleep 3
@make -C $(CURDIR) db
.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
# aiohttp
@make aiohttp OPTS="-p pid -D -w 2"
@sleep 2
@make wrk TESTEE=aiohttp
@kill `cat $(CURDIR)/pid`
@sleep 3
# bottle
@make bottle OPTS="-p pid -D -w 2"
@sleep 2
@make wrk TESTEE=bottle
@kill `cat $(CURDIR)/pid`
@sleep 3
# django
@make django OPTS="-p pid -D -w 2"
@sleep 2
@make wrk TESTEE=django
@kill `cat $(CURDIR)/pid`
@sleep 4
# falcon
@make falcon OPTS="-p pid -D -w 2"
@sleep 2
@make wrk TESTEE=falcon
@kill `cat $(CURDIR)/pid`
@sleep 3
# flask
@make flask OPTS="-p pid -D -w 2"
@sleep 2
@TESTEE=flask $(WRK) http://127.0.0.1:5000/json
@TESTEE=flask $(WRK) http://127.0.0.1:5000/remote
@TESTEE=flask $(WRK) http://127.0.0.1:5000/complete
@kill `cat $(CURDIR)/pid`
@sleep 3
# muffin
@make muffin OPTS="--daemon --pid $(CURDIR)/pid --workers 2"
@sleep 2
@make wrk TESTEE=muffin
@kill `cat $(CURDIR)/pid`
@sleep 3
# pyramid
@make pyramid OPTS="-p pid -D -w 2"
@sleep 2
@make wrk TESTEE=pyramid
@kill `cat $(CURDIR)/pid`
@sleep 3
# wheezy
@make wheezy OPTS="-p pid -D -w 2"
@sleep 2
@make wrk TESTEE=wheezy
@kill `cat $(CURDIR)/pid`
@sleep 3
# tornado
@make tornado OPTS="-p pid -D -w 2"
@sleep 2
@make wrk TESTEE=tornado
@kill `cat $(CURDIR)/pid`
@sleep 3
# weppy
@make weppy OPTS="-p pid -D -w 2"
@sleep 2
@make wrk TESTEE=weppy
@kill `cat $(CURDIR)/pid`
@sleep 3
# wsgi
@make wsgi OPTS="-p pid -D -w 2"
@sleep 2
@make wrk TESTEE=wsgi
@kill `cat $(CURDIR)/pid`
@sleep 3
# twisted
# @make twisted OPTS="-pid &"
# @sleep 1
# @TESTEE=twisted $(WRK) http://127.0.0.1:5000/json
# @TESTEE=twisted $(WRK) http://127.0.0.1:5000/remote
# @TESTEE=twisted $(WRK) http://127.0.0.1:5000/complete
# @kill `cat $(CURDIR)/pid`
# @sleep 2
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)
@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
muffin: $(VIRTUAL_ENV)
@cd $(CURDIR)/frameworks/muffin && \
DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/muffin app run $(OPTS) --bind 127.0.0.1:5000
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:
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
--worker-class=gunicorn.workers.gtornado.TornadoWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/tornado
twisted:
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/python $(CURDIR)/frameworks/twisted/app.py
wheezy:
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
-k meinheld.gmeinheld.MeinheldWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/wheezy
weppy:
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
-k meinheld.gmeinheld.MeinheldWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/weppy
wsgi:
@DHOST=$(DHOST) $(VIRTUAL_ENV)/bin/gunicorn app:app $(OPTS) \
-k meinheld.gmeinheld.MeinheldWorker --bind=127.0.0.1:5000 \
--chdir=$(CURDIR)/frameworks/wsgi