Benchmark Node.js PostgreSQL vs MySQL vs MongoDB #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Benchmark Node.js PostgreSQL vs MySQL vs MongoDB | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: write-all | |
jobs: | |
bench: | |
name: Benchmark | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:16.3 | |
env: | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
mongodb: | |
image: mongo:5.0.26 | |
env: | |
MONGO_INITDB_ROOT_USERNAME: admin | |
MONGO_INITDB_ROOT_PASSWORD: admin | |
MONGO_INITDB_DATABASE: APP-DATABASE | |
ports: | |
- 27017:27017 | |
options: >- | |
--health-cmd mongo | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
mysql: | |
image: mysql:8 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: mysqltest | |
MYSQL_USER: mysqltest | |
MYSQL_PASSWORD: mysqltest | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=5 | |
steps: | |
- name: Verify MySQL connection and mysqltest DB exists | |
run: mysql --host 0.0.0.0 --port 3306 -umysqltest -pmysqltest -e "SHOW DATABASES LIKE 'mysqltest'" | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: true | |
ref: ${{ github.head_ref }} | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: 22 | |
- name: Install dependencies | |
run: npm i | |
- name: Run Benchmark | |
run: node benchmark.js > "./results/test_$(date '+%Y-%m-%d_%H-%M-%S').txt" | |
- name: Update README.md | |
run: node update-readme.js | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions |