@@ -4,53 +4,41 @@ Here you can load test a `psqlpy`, `asycnpg` and `psycopg` drivers in order to c
44
55## How to run
66
7- 1 . First of all you have to launch ` grafana ` and ` influxdb ` that are present in docker-compose.yaml file.
8- You can lanch it via:
7+ 1 . Run Postgresql database somewhere. We recommend run an external database outside of your local machine.
8+ 2 . Store ` database_dsn ` in ` settings.py `
9+ 3 . Install dependencies: ` poetry install `
10+ 4 . Fill database with mock data: ` python psqlpy_stress/mocker.py `
11+ 5 . Run the application: ` gunicorn psqlpy_stress.app:app -b 127.0.0.1:8080 -w 4 -k aiohttp.GunicornWebWorkeron `
12+ 6 . Install [ bombardier] ( https://github.com/codesenberg/bombardier )
13+ 7 . Start bombarding application: ` bombardier -c 10 -d 60s -l http://127.0.0.1:8080/psqlpy-simple-transaction-select `
914
10- ``` bash
11- docker compose up
12- ```
13-
14- 2 . Log in to IfluxDB. Default credential are ` admin ` :` admin ` . Save token that will be shown to you after login.
15- 3 . Create InfluxDB abstractions
16-
17- - Create an InfluxDB organization named ` psqlpy-stress-test ` .
18- - Create a bucket inside InfluxDB named ` psqlpy-stress-bucket ` .
19-
20- > You can create bucket and organization with different names.
21- > But do not forget to replace those values within ` psqlpy_stress.settings ` file.
15+ You can change driver inside your url in order to test specific driver like:
2216
23- 4 . Connect InfluxDB to grafana.
24- host: ` http://influxdb:8086 `
25- database: ` psqlpy-stress-bucket `
26- user: ` admin `
27- password: is your token that you have saved at ` step 2 `
17+ - ` http://127.0.0.1:8080/psqlpy-simple-transaction-select `
18+ - ` http://127.0.0.1:8080/asyncpg-simple-transaction-select `
19+ - ` http://127.0.0.1:8080/psycopg-simple-transaction-select `
2820
29- 5 . Import a dashboard to a grafana, named ` dashboad.yaml ` , located in root directory.
30- This dashboard displays certain important parameters:
21+ Also you can go and check out all available urls in ` psqlpy_stress.api.plain_queries `
3122
32- - p99 latency
33- - p95 latency
34- - p90 latency
35- - p50 latency
36- - mean latency
37- - p50 rps
23+ ## Results interpretation
3824
39- 6 . Run poetry install in root
40- 7 . Apply migrations to database (default database is in docker-compose).
41- You can change ` database_url ` inside ` psqlpy_stress.settings ` file in order to connect to external database.
25+ You would receive such data as output after bombarding
4226
43- Migrations can be applied via:
44-
45- ``` bash
46- alembic upgrade head
47- ```
48-
49- 8 . Past in your InfluxDB token into ` psqlpy_stress.settings ` file.
50- 9 . Launch application via
51-
52- ``` bash
53- python -m psqlpy_stress.app
27+ ```
28+ Done!
29+ Statistics Avg Stdev Max
30+ Reqs/sec 485.28 115.61 1065.30
31+ Latency 20.60ms 5.01ms 67.93ms
32+ Latency Distribution
33+ 50% 20.89ms
34+ 75% 23.41ms
35+ 90% 24.4ms
36+ 95% 30.76ms
37+ 99% 32.73ms
38+ HTTP codes:
39+ 1xx - 0, 2xx - 29117, 3xx - 0, 4xx - 0, 5xx - 0
40+ others - 0
41+ Throughput: 116.55KB/s
5442```
5543
56- 10 . You can start load testing drivers .
44+ You can compare drivers by received percentiles and reqs/sec performance .
0 commit comments