https://github.com/mikeshultz/pgstorm
A PostgreSQL load tester with basic tests written in python.
https://github.com/mikeshultz/pgstorm
load-testing postgresql
Last synced: about 2 months ago
JSON representation
A PostgreSQL load tester with basic tests written in python.
- Host: GitHub
- URL: https://github.com/mikeshultz/pgstorm
- Owner: mikeshultz
- License: mit
- Created: 2017-11-25T19:40:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-25T20:07:57.000Z (over 8 years ago)
- Last Synced: 2025-02-22T22:27:48.898Z (over 1 year ago)
- Topics: load-testing, postgresql
- Language: Python
- Size: 6.84 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pgstorm
PostgreSQL load testing tool with real world tests.
## Install
git clone https://github.com/mikeshultz/pgstorm.git && cd pgstorm && python setup.py install
## Usage
usage: pgstorm [-h] [-t N] [-d DELAY] [-l LEVEL] [-y TYPE] [-v VALUE]
DSN [FILE]
PostgreSQL load testing.
positional arguments:
DSN pg connection string (default:
postgresql://localhost:5432/postgres)
FILE sql file to run(or stdin)
optional arguments:
-h, --help show this help message and exit
-t N, --threads N amount of threads to start
-d DELAY, --delay DELAY
thread health check delay in seconds(default: 0.05)
-l LEVEL, --log-level LEVEL
log level(default: WARNING)
-y TYPE, --type TYPE test type M - Must have results, N - Must return
--value rows, E - Equal too --value
-v VALUE, --value VALUE
value comparison for test type
## Examples
### Run SQL File
Run an SQL file, with perhaps dozens of taxing queries.
pgstorm -t 5 postgresql://localhost:5432/mydb mytest.sql
### Require Any Results
Make sure that any results are returned at all(at least one row):
echo "SELECT TRUE FROM \"user\" WHERE usename = 'mike';" | pgstorm -y M postgresql://localhost:5432/mydb
### Require Row Count
If you want to make sure a query always returns 3 rows:
pgstorm -y N -v 3 postgresql://localhost:5432/mydb return_three_rows.sql
### Require Value
You may want to check against an exact value to make sure you're getting
consistent results.
For instance, you want to make sure you always get `record_id` = 153:
echo "SELECT record_id FROM records WHERE name = 'Jones';" | pgstorm -y E -v 153 postgresql://localhost:5432/mydb get_user.sql