Update README for loadtesting greatness
This commit is contained in:
Родитель
33ec48cfd9
Коммит
b2c5be3df4
|
@ -7,3 +7,5 @@ node_modules
|
||||||
breach_hashsets
|
breach_hashsets
|
||||||
version.json
|
version.json
|
||||||
public/js/vendor
|
public/js/vendor
|
||||||
|
loadtests/__pycache__
|
||||||
|
loadtests/venv
|
||||||
|
|
|
@ -4,10 +4,25 @@
|
||||||
|
|
||||||
- Python 3.6
|
- Python 3.6
|
||||||
- pip
|
- pip
|
||||||
- venv
|
- virtualenv
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ virtualenv venv -p python3
|
||||||
|
$ source ./venv/bin/activate
|
||||||
|
$ pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
TODO
|
|
||||||
|
## Running the load tests
|
||||||
|
|
||||||
|
To run the exquisite load tests, simply run <kbd>$ ./run.sh</kbd>.
|
||||||
|
To modify the default settings, tweak the settings in ./molotov.env.
|
||||||
|
|
||||||
|
By default, the load tests will run for 180s (3 minutes), with 20 processes (each w/ 10 workers, for a total of 200 workers).
|
||||||
|
|
||||||
|
```ini
|
||||||
|
DURATION=180
|
||||||
|
PROCESSES=20
|
||||||
|
WORKERS=10
|
||||||
```
|
```
|
||||||
|
|
|
@ -8,14 +8,17 @@ SCAN_URL = '{}/scan'.format(SERVER_URL)
|
||||||
# This hash is for test@example.com (via `node scripts/make-sha1-hashes.js`)
|
# This hash is for test@example.com (via `node scripts/make-sha1-hashes.js`)
|
||||||
TEST_EMAIL_HASH = '567159d622ffbb50b11b0efd307be358624a26ee'
|
TEST_EMAIL_HASH = '567159d622ffbb50b11b0efd307be358624a26ee'
|
||||||
|
|
||||||
|
WEIGHT_HOMEPAGE = int(getenv('WEIGHT_HOMEPAGE', 0))
|
||||||
|
WEIGHT_SCAN = int(getenv('WEIGHT_SCAN', 0))
|
||||||
|
|
||||||
@scenario(weight=50)
|
|
||||||
|
@scenario(weight=WEIGHT_HOMEPAGE)
|
||||||
async def homepage_test(session):
|
async def homepage_test(session):
|
||||||
async with session.get(HOMEPAGE_URL) as resp:
|
async with session.get(HOMEPAGE_URL) as resp:
|
||||||
assert resp.status == 200
|
assert resp.status == 200
|
||||||
|
|
||||||
|
|
||||||
@scenario(weight=50)
|
@scenario(weight=WEIGHT_SCAN)
|
||||||
async def scan_test(session):
|
async def scan_test(session):
|
||||||
async with session.post(SCAN_URL, data={'emailHash': TEST_EMAIL_HASH}) as resp:
|
async with session.post(SCAN_URL, data={'emailHash': TEST_EMAIL_HASH}) as resp:
|
||||||
assert resp.status == 200
|
assert resp.status == 200
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
PROJECT=FirefoxMonitor
|
||||||
|
SERVER_URL=https://fx-breach-alerts.herokuapp.com
|
||||||
|
|
||||||
|
VERBOSE=-v
|
||||||
|
|
||||||
|
TEST_MODULE=loadtest.py
|
||||||
|
RUN_DELAY=0
|
||||||
|
|
||||||
|
DURATION=180
|
||||||
|
PROCESSES=20
|
||||||
|
WORKERS=10
|
||||||
|
|
||||||
|
export WEIGHT_HOMEPAGE=1
|
||||||
|
export WEIGHT_SCAN=1
|
|
@ -0,0 +1,12 @@
|
||||||
|
source molotov.env
|
||||||
|
|
||||||
|
echo "WEIGHT_HOMEPAGE=$WEIGHT_HOMEPAGE"
|
||||||
|
echo "WEIGHT_SCAN=$WEIGHT_SCAN"
|
||||||
|
echo "DURATION=$DURATION"
|
||||||
|
echo "PROCESSES=$PROCESSES"
|
||||||
|
echo "WORKERS=$WORKERS"
|
||||||
|
echo "DELAY=$RUN_DELAY"
|
||||||
|
|
||||||
|
WEIGHT_HOMEPAGE=$WEIGHT_HOMEPAGE \
|
||||||
|
WEIGHT_SCAN=$WEIGHT_SCAN \
|
||||||
|
time molotov "$VERBOSE" -d "$DURATION" -p "$PROCESSES" -w "$WORKERS" --delay "$RUN_DELAY" loadtest.py
|
Загрузка…
Ссылка в новой задаче