This test provides a structure for running data modification queries repeatedly while at the same time measuring the performance of reactive queries using different packages supporting them:
A reading of index.js (variable QUERIES) is recommended to understand the operations
performed. See livequery.sql for a reactive query used. By default,
the benchmark opens 50 parallel reactive queries, each reactive query having a different
assignments.class_id condition, and inserts 100 rows into scores table per second,
updates 100 rows in scores table per second, and deletes 100 rows from scores table per second.
The following commands can be used to get the application running on your machine:
$ npm install
# Configure database connection string (CONN_STR)
$ vim index.js
# Start the application with the following command: (Output file is optional)
$ node --experimental-worker --expose-gc index.js reactive-postgres-columns out.jsonThe first argument tell which package/configuration to use. Available options are:
reactive-postgres-columns: incolumnsmodereactive-postgres-changed: inchangedmodereactive-postgres-full: infullmodepg-live-selectpg-live-query-watch: usingwatch(unstable initialization, has to be tried multiple times)pg-live-query-query: usingquery(unstable initialization, has to be tried multiple times)pg-query-observer(it does not work with multiple parallel queries)
Run it for a minute or more and press ctrl+c to exit and display benchmark graphs.
The following measurements are done:
- Used node heap every second.
- Total node heap every second.
- Time between a data modification query being issued to the database, and when a reactive query emitted a corresponding event.
If an output file is specified, it may be viewed using viewer.html.
To use this test result viewer, first start a web server in the root directory of the
repository:
$ python -m SimpleHTTPServerThen load the output JSON file by specifying it in the query string:
http://localhost:8000/viewer.html?out.json
Evaluated using node v11.6.0 on Linux and PostgreSQL 11.1 Docker image,
postgres:11.1, with default configuration.
The following command was used for each of the available packages/configurations:
$ timeout --foreground --signal=INT --kill-after=5 300 node --experimental-worker --expose-gc index.js package <package>.jsonResults are available through web viewer:
reactive-postgres-columnsreactive-postgres-changedreactive-postgres-fullpg-live-selectpg-live-query-watchpg-live-query-query- pg-query-observer: does not work with multiple parallel queries