Skip to content

mikeshultz/pgstorm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 

About

A PostgreSQL load tester with basic tests written in python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages