File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11dist : xenial
2+
23language : python
4+
35python :
46 - " 3.5"
57 - " 3.6"
68 - " 3.7"
9+
10+ before_install :
11+ - sudo apt-get install -y wrk
12+
713install :
8- - pip install --upgrade pip wheel pyo3-pack pytest hypothesis
14+ - pip install --upgrade pip wheel pyo3-pack pytest hypothesis gunicorn uwsgi flask
915 - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
1016 - PATH=$HOME/.cargo/bin:$PATH cargo update
17+
1118script :
1219 - PATH=$HOME/.cargo/bin:$PATH ./build --strip
1320 - pytest -v test
21+ - ./integration/run thread
22+ - ./integration/run gunicorn
23+ - ./integration/run uwsgi
Original file line number Diff line number Diff line change @@ -11,4 +11,7 @@ pip install --upgrade \
1111 ujson \
1212 python-rapidjson \
1313 matplotlib \
14- tabulate
14+ tabulate \
15+ uwsgi \
16+ gunicorn \
17+ flask
Original file line number Diff line number Diff line change 11#! /bin/sh -e
22
3- wrk -d 30 -c 4 http://127.0.0.1:8000/
3+ wrk -d 15 -c 2 http://127.0.0.1:8000/
Original file line number Diff line number Diff line change 1- #! /bin/sh -e
1+ #! /usr/ bin/env bash
22
3- PYTHONPATH=. gunicorn --preload --workers 4 " $@ " wsgi:app
3+ set -e
4+
5+ _dir=" $( dirname " ${BASH_SOURCE[0]} " ) "
6+
7+ PYTHONPATH=${_dir} gunicorn --preload --max-requests 100 --workers 2 " $@ " wsgi:app
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ _dir=" $( dirname " ${BASH_SOURCE[0]} " ) "
6+
7+ to_run=" ${@:- thread uwsgi gunicorn} "
8+
9+ if [[ $to_run == * " thread" * ]]; then
10+ " ${_dir} " /thread
11+ fi
12+
13+ if [[ $to_run == * " gunicorn" * ]]; then
14+ " ${_dir} " /gunicorn --daemon
15+ sleep 2
16+ " ${_dir} " /client
17+ pkill -f -9 ' wsgi:app'
18+ fi
19+
20+ if [[ $to_run == * " uwsgi" * ]]; then
21+ " ${_dir} " /uwsgi --daemonize 2
22+ sleep 2
23+ " ${_dir} " /client
24+ pkill -f -9 ' wsgi:app'
25+ fi
Original file line number Diff line number Diff line change @@ -30,15 +30,14 @@ STATUS = 0
3030def test_func (n ):
3131 try :
3232 assert sorted (orjson .loads (orjson .dumps (DATA )), key = itemgetter ('id' )) == DATA
33- print ("thread %s: %s dumps, loads" % (get_ident (), n ))
3433 except Exception :
3534 STATUS = 1
3635 traceback .print_exc ()
3736 print ("thread %s: %s dumps, loads ERROR" % (get_ident (), n ))
3837
3938
4039with ThreadPoolExecutor (max_workers = 4 ) as executor :
41- executor .map (test_func , range (50000 ), chunksize = 1000 )
40+ executor .map (test_func , range (20000 ), chunksize = 1000 )
4241 executor .shutdown (wait = True )
4342
4443
Original file line number Diff line number Diff line change 1- #! /bin/sh -e
1+ #! /usr/ bin/env bash
22
3- PYTHONPATH=. uwsgi --http :8000 --processes 4 " $@ " --mount /=wsgi:app
3+ set -e
4+
5+ _dir=" $( dirname " ${BASH_SOURCE[0]} " ) "
6+
7+ PYTHONPATH=${_dir} uwsgi --http :8000 --processes 2 " $@ " --mount /=wsgi:app
You can’t perform that action at this time.
0 commit comments