Browse Source

Add quickstart to readme + clarify settings.ini dependency in results

master
Adam Pippin 4 years ago
parent
commit
de543cff86
  1. 53
      README.md

53
README.md

@ -19,10 +19,61 @@ Two scripts:
* Right now this only supports Postgres. It would be trivial to modify to use anything else supported by PHP's PDO.
* It's very unscientific. Don't rely on this for anything more than a vague notion of how something is performing.
* The results script loads the entire set of queries + timings into RAM to process them. If you run this too long and
generate too many results it will not be very performant or require a huge amount of RAM to actually generate the results.
generate too many results it will not be very performant or require a huge amount of RAM to actually generate the results.
* The results script uses the _current_ settings file when calculating QPS, figuring out which worker files to read, etc.
The settings.ini file should be kept alongside the results files if you plan on reprocessing them again later for any
reason.
## How do I use this?
```
$ mkdir test-1
$ cd test-1
$ cat > settings.ini
workers=16
duration=30
[db]
host=127.0.0.1
port=5432
username=postgres
password=postgres
database=my_database
^D
$ cat > generator.php
<?php
return "select * from my_table where id=".mt_rand(1, 65000);
^D
$ php path/to/bench.php generator.php
[Worker 0] Start
[Worker 1] Start
[Worker 2] Start
[Master] Start
[Worker 3] Start
[Worker 3] Stop
[Worker 1] Stop
[Worker 2] Stop
[Master] Stop
[Worker 0] Stop
$ php path/to/results.php
5 percentile: 0.0417s
25 percentile: 0.042s
50 percentile: 0.0424s
75 percentile: 0.0431s
95 percentile: 0.0459s
99 percentile: 0.0505s
QPS: 93.6
$
```
## Okay... what?
### Set up test environment
The settings will be read from the current folder, and the results written back out to it. So probably create an empty

Loading…
Cancel
Save