Skip to content

Performance Tests - RAM disk #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14.15.0
1 change: 0 additions & 1 deletion example-application/data-access/order-repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module.exports = class OrderReposiroty {
}

async addOrder(orderDetails) {

return await orderModel.create(orderDetails);
}
};
10 changes: 2 additions & 8 deletions example-application/test/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3"
version: "3.6"
services:
db:
image: postgres:11
Expand All @@ -10,10 +10,4 @@ services:
container_name: "postgres-for-testing"
ports:
- "54320:5432"
volumes:
- data:/var/lib/postgresql/data
volumes:
data:
driver_opts:
type: tmpfs
device: tmpfs
tmpfs: /var/lib/postgresql/data
15 changes: 15 additions & 0 deletions various-receipes/performance/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Tests Performance

## In-Memory DB
TL;DR: don't bother

A common time-consuming operation on a typical server is database query, and slow tests are bad.
Database queries are expensive, also because the data resides on the drive, which is very slowly relative to other parts of the computer.
One method to speed up the database for testing and local-development is to run the database on RAM, which is way faster than the drive.

But is it worth it? Probably not, and this is why:
1. SSD is pretty much a standard now, and they are blazingly fast compared to the old HHD.
2. It's preferred and easier to configure your database for non-durable settings to reduce database-related I/O drastically.
3. Usually, test scenarios don't involve much data, so the DB's I/O-speed becomes secondary.
4. The performance between in-memory and regular database with the correct settings is neglectable (if any).
Detailed benchmarks and results can be found [here](https://github.com/testjavascript/integration-tests-a-z/issues/9#issuecomment-710674437).
Loading