Skip to content

mitar/node-pg-reactivity-benchmark

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Benchmark of reactive queries for PostgreSQL

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.json

The first argument tell which package/configuration to use. Available options are:

  • reactive-postgres-columns: in columns mode
  • reactive-postgres-changed: in changed mode
  • reactive-postgres-full: in full mode
  • pg-live-select
  • pg-live-query-watch: using watch (unstable initialization, has to be tried multiple times)
  • pg-live-query-query: using query (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.

Results viewer

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 SimpleHTTPServer

Then load the output JSON file by specifying it in the query string: http://localhost:8000/viewer.html?out.json

Results

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>.json

Results are available through web viewer:

About

Benchmark of reactive queries for PostgreSQL

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 89.0%
  • HTML 11.0%