Skip to content

chore: apply non-durability settings to test postgres container #2479

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 1 commit into from
Jun 17, 2022

Conversation

johnstcn
Copy link
Member

This commit applies some recommended settings to sacrifice durability
for speed for our testing database:

  • Mount PGDATA dir in RAM (--tmpfs /tmp)
  • Turn off fsync
  • Turn off synchronous_commit
  • Turn off full_page_writes

Ref: https://www.postgresql.org/docs/current/non-durability.html

You can argue that if we are already storing the tmpfs in memory, why do we want the other stuff to avoid disk I/O?
My response is:

  • What if we're swapping
  • Why not just do it anyway

I tested this out in my v2 workspace (template=coder)
Before: average runtime = 146.6s (N=3)
After: average runtime = 106.4s (N=3)

This commit applies some recommended settings to sacrifice durability
for speed for our testing database:
  - Mount PGDATA dir on a tmpfs (--tmpfs /tmp)
  - Turn off fsync
  - Turn off synchronous_commit
  - Turn off full_page_writes

  Ref: https://www.postgresql.org/docs/current/non-durability.html
@johnstcn johnstcn requested a review from a team June 17, 2022 18:59
@johnstcn johnstcn self-assigned this Jun 17, 2022
@@ -127,13 +127,17 @@ test-postgres-docker:
--env POSTGRES_USER=postgres \
--env POSTGRES_DB=postgres \
--env PGDATA=/tmp \
--tmpfs /tmp \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was apparently not a tmpfs before!

Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice changes, I think these are solid for a test-setup!

Copy link
Member

@Emyrk Emyrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

Copy link
Contributor

@coadler coadler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@johnstcn johnstcn merged commit 0d2f0d7 into main Jun 17, 2022
@johnstcn johnstcn deleted the cj/make-test-postgres-docker-fast branch June 17, 2022 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants