benchmarking (danionescu0/docker-flask-mongodb-example) random service using apache benchmark
FROM pypy:3-slim
ARG requirements
RUN apt-get update
RUN apt install git -y
WORKDIR /root
RUN git clone https://github.com/danionescu0/docker-flask-mongodb-example.git flask-mongodb-example
WORKDIR /root/flask-mongodb-example/python
RUN pip install -qr $requirements
EXPOSE 5000
...
web-random:
build:
context: ./docker-python
args:
requirements: /root/flask-mongodb-example/python/requirements.txt
image: web-standard
ports:
- "800:5000"
entrypoint: python /root/flask-mongodb-example/python/random_demo.py
depends_on:
- mongo
- web-base-image
web-random-pypy:
build:
context: ./docker-python-pypy
args:
requirements: /root/flask-mongodb-example/python/requirements.txt
image: web-standard-pypy
ports:
- "801:5000"
entrypoint: pypy /root/flask-mongodb-example/python/random_demo.py
depends_on:
- mongo
...
ab -n 3000 -c 10 http://localhost:800/random?upper=1000&lower=10
Intel(R) Core(TM) i3-8109U CPU @ 3.00GHz, 8GB DDR4 2400 MHz RAM and Solid state drive Linux 5.4.0-66-generic, Ubuntu 20.04.1 LTS
Completed 300 requests
Completed 600 requests
Completed 900 requests
Completed 1200 requests
Completed 1500 requests
Completed 1800 requests
Completed 2100 requests
Completed 2400 requests
Completed 2700 requests
Completed 3000 requests
Finished 3000 requests
Server Software: Werkzeug/1.0.1
Server Hostname: localhost
Server Port: 800
Document Path: /random?upper=1000
Document Length: 3 bytes
Concurrency Level: 10
Time taken for tests: 2.668 seconds
Complete requests: 3000
Failed requests: 292
(Connect: 0, Receive: 0, Length: 292, Exceptions: 0)
Total transferred: 443710 bytes
HTML transferred: 8710 bytes
Requests per second: 1124.54 [#/sec] (mean)
Time per request: 8.893 [ms] (mean)
Time per request: 0.889 [ms] (mean, across all concurrent requests)
Transfer rate: 162.42 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 8
Processing: 1 9 5.6 7 66
Waiting: 0 8 4.5 6 53
Total: 1 9 5.7 7 66
Percentage of the requests served within a certain time (ms)
50% 7
66% 9
75% 10
80% 11
90% 15
95% 19
98% 26
99% 36
100% 66 (longest request)
[1]+ Done ab -n 3000 -c 10 http://localhost:800/random?upper=1000
Completed 300 requests
Completed 600 requests
Completed 900 requests
Completed 1200 requests
Completed 1500 requests
Completed 1800 requests
Completed 2100 requests
Completed 2400 requests
Completed 2700 requests
Completed 3000 requests
Finished 3000 requests
Server Software: Werkzeug/1.0.1
Server Hostname: localhost
Server Port: 800
Document Path: /random?upper=1000
Document Length: 3 bytes
Concurrency Level: 10
Time taken for tests: 3.698 seconds
Complete requests: 3000
Failed requests: 273
(Connect: 0, Receive: 0, Length: 273, Exceptions: 0)
Total transferred: 440731 bytes
HTML transferred: 8731 bytes
Requests per second: 811.33 [#/sec] (mean)
Time per request: 12.325 [ms] (mean)
Time per request: 1.233 [ms] (mean, across all concurrent requests)
Transfer rate: 116.40 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 4
Processing: 6 12 3.5 12 69
Waiting: 6 11 3.2 10 66
Total: 6 12 3.6 12 72
Percentage of the requests served within a certain time (ms)
50% 12
66% 12
75% 13
80% 13
90% 15
95% 17
98% 19
99% 21
100% 72 (longest request)
[1]+ Done ab -n 3000 -c 10 http://localhost:800/random?upper=1000