Skip to content
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

Add ENV["SKIP_TEST_DATABASE_TRUNCATE"] flag to speed up multi-process test runs #51686

Merged
merged 2 commits into from May 7, 2024

Conversation

dhh
Copy link
Member

@dhh dhh commented Apr 29, 2024

Add ENV["SKIP_TEST_DATABASE_TRUNCATE"] flag to speed up multi-process test runs on large DBs when all tests run within default txn.

This cuts ~10s from the test run of HEY when run by 24 processes against the 178 tables, since ~4,000 table truncates can then be skipped.

@dhh
Copy link
Member Author

dhh commented Apr 29, 2024

Unrelated CI failure:
image

@byroot
Copy link
Member

byroot commented Apr 30, 2024

This cuts ~10s from the test run of HEY when run by 24 processes against the 178 tables, since ~4,000 table truncates can then be skipped.

Are these 24 processes pointing to the same database? Because it sounds more like your issue is DB locking rather than TRUNCATE specifically.

@dhh
Copy link
Member Author

dhh commented Apr 30, 2024

No, by default we create 1 DB per process. But it's of course the same physical database, even if they're logically separated. Same difference in the end though. Wherever the contention is, not truncating 4K empty tables provides a substantial speedup.

@dhh dhh merged commit e8e077d into main May 7, 2024
5 of 7 checks passed
@dhh dhh deleted the skip-test-db-truncate-flag branch May 7, 2024 00:04
fractaledmind pushed a commit to fractaledmind/rails that referenced this pull request May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants