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

possibility to run containers with fsync=off #1256

Closed
alexanderkjall opened this issue Feb 19, 2019 · 6 comments
Closed

possibility to run containers with fsync=off #1256

alexanderkjall opened this issue Feb 19, 2019 · 6 comments

Comments

@alexanderkjall
Copy link

According to this article: https://pythonspeed.com/articles/faster-db-tests/ a lot of speed can be gained when running postgresql in docker with fsync=off.

When I look at the docker image that testcontainers start with "docker inspect" it doesn't seem to run it with fsync off, and I have tried to play around with the .withCommand() and .addEnv() functions without success.

Is there a recommended way to set -c fsync=off in the docker run command? If yes, could this maybe be a bit better exposed?

@kiview
Copy link
Member

kiview commented Feb 19, 2019 via email

@alexanderkjall
Copy link
Author

That was a good suggestion, setting tmpfs to "/var/lib/postgresql/data" moved my heaviest tests from taking roughly 17 seconds to 3 seconds and the whole testsuite from about 90 seconds to 60 seconds.

@bsideup
Copy link
Member

bsideup commented Feb 19, 2019 via email

@alexanderkjall
Copy link
Author

Sure, I'll try to write a pull request tomorrow or the day after.

@alexanderkjall
Copy link
Author

@bsideup I looked at creating a pull request yesterday, but I'm not really friends with gradle and the testsuite completely hosed my old laptop, but it looked like it might just be a one line change.

I'm sorry to say that someone else needs to create the pull request, I don't have enough free time to do it and do it well.

mumukiller pushed a commit to mumukiller/testcontainers-java that referenced this issue Feb 27, 2019
@rnorth rnorth added this to the 1.11.0 milestone Mar 22, 2019
@rnorth
Copy link
Member

rnorth commented Mar 22, 2019

Releasing this in 1.11.0 🎉

@bsideup bsideup closed this as completed Apr 16, 2019
rgba pushed a commit to rgba/testcontainers-scala that referenced this issue Aug 28, 2019
- added options to specify postgres database configuration for
  databaseName, username and password, which can now be defined when
  instantiating a new container

- added configuration option mountPostgresDataToTmpfs, which allows to
  mount the postgres data directory (/var/lib/postgresql/data) inside
  the docker container to an in-memory volume for improved performance
  (see testcontainers/testcontainers-java#1256)
dimafeng pushed a commit to testcontainers/testcontainers-scala that referenced this issue Aug 28, 2019
* Adding more configuration options to PostgresSQLContainer

- added options to specify postgres database configuration for
  databaseName, username and password, which can now be defined when
  instantiating a new container

- added configuration option mountPostgresDataToTmpfs, which allows to
  mount the postgres data directory (/var/lib/postgresql/data) inside
  the docker container to an in-memory volume for improved performance
  (see testcontainers/testcontainers-java#1256)

* - removed dangling colon in apply() function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants