event-driven-io / Pongo

Pongo - Mongo but on Postgres and with strong consistency benefits
https://event-driven-io.github.io/Pongo/
MIT License
1.21k stars 30 forks source link

Added basic benchmarks for writes and reads #68

Closed oskardudycz closed 2 months ago

oskardudycz commented 2 months ago

To run them, you either need to define BENCHMARK_POSTGRESQL_CONNECTION_STRING environment variable, or setup it through .env file in src/packages/dumbo/src folder. If not provided, it'll use the default docker config, so: postgresql://postgres@localhost:5432/postgres.

You can also set BENCHMARK_CONNECTION_POOLED to true or false to decide if you're running pooled or non-pooled connection.

You can run it through cmd line going to src folder:

$ npm run benchmark --workspace=@event-driven-io/dumbo

Currently when I run them from my local computer against the basic free tier NeonDB in FRA region (I'm in Poland) I got:

INSERTING records in transaction x 9.60 ops/sec ±0.59% (49 runs sampled)
READING records x 28.74 ops/sec ±0.88% (68 runs sampled)

Benchmark: INSERTING records in transaction
  Operations per second: 9.60 ops/sec
  Mean execution time: 104.14 ms
  Standard deviation: 2.20 ms
  Margin of error: ±0.59%
  Sample size: 49 runs

Benchmark: READING records
  Operations per second: 28.74 ops/sec
  Mean execution time: 34.80 ms
  Standard deviation: 1.29 ms
  Margin of error: ±0.88%
  Sample size: 68 runs

Benchmark: INSERTING records in transaction Operations per second: 2.57 ops/sec Mean execution time: 389.06 ms Standard deviation: 75.57 ms Margin of error: ±9.99% Sample size: 17 runs

Benchmark: READING records Operations per second: 3.10 ops/sec Mean execution time: 323.08 ms Standard deviation: 90.45 ms Margin of error: ±13.49% Sample size: 19 runs



They show that the main issue lies in establishing the connection.