SDC-GoldEngine / questions-and-answers

MIT License
0 stars 0 forks source link

Switch PostgreSQL driver to postgres.js #11

Closed slargman closed 2 years ago

slargman commented 2 years ago

postgres.js driver performance

Test parameters avg response time (ms) min/max response time (ms) response counts RPS error rate
1 request/s for 1 min 67 62/163 60 1 0%
100 requests/s for 1 min 64 61/187 6000 100 0%
1000 requests/s for 1 min 1289 61/2583 57598 960 0%
1000 requests/s for 1 min (2nd of batch) 66 61/264 60000 1000 0%
1000 requests/s for 1 min (3rd of batch) 69 61/360 60000 1000 0%
2000 requests/s for 1 min 3252 76/4615 60277 1005 0%
5000 requests/s for 1 min 14522 124/50695 33322 555 0%
10,000 requests/s for 1 min 20193 129/59266 6085 101 0%
10,000 requests/s for 1 min 18045 125/59851 7344 122 0%

Analysis

The first test at 1000 RPS showed pretty poor performance (although still drastically better than the node-postgres driver). Subsequent tests at 1000 RPS showed great performance, possibly due to the impact of prepared statements from previous tests. With this change, performance at 1000 RPS is satisfactory and the next goal is a similar performance at 2000 RPS.

With this change, RPS seems to top out at about 1000, given the requests at 2000 requests/s.

Changing the max number of connections to the postgres server from 10 to 50 or 100 actually produced significantly worse performance, so I will keep it at 10 connections.

Conclusion

Overall, performance improved significantly. I will be incorporating these changes into main.