Testcontainers-java: possibility to run containers with fsync=off

Created on 19 Feb 2019  Â·  6Comments  Â·  Source: testcontainers/testcontainers-java

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?

good first issue modulejdbc typfeature

Most helpful comment

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.

All 6 comments

Sounds interesting.
Btw. you can already use the Testcontainers Postgres module with tempfs (
https://docs.docker.com/storage/tmpfs/), which might provide the same speed
boost.

Alexander Kjäll notifications@github.com schrieb am Di., 19. Feb. 2019,
20:24:

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?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/testcontainers/testcontainers-java/issues/1256, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AE2jaNJJeCGIjK57JOHamlckL5O7XhW3ks5vPE-GgaJpZM4bDsJY
.

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.

Whoa! Nice, we should set it by default!
Perhaps you want to contribute? 🤞
On Tue, 19 Feb 2019 at 22:23, Alexander Kjäll notifications@github.com
wrote:

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.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/testcontainers/testcontainers-java/issues/1256#issuecomment-465315718,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABAIimgnCOjhIfo3erjlGbGNnDirfER7ks5vPGtKgaJpZM4bDsJY
.

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

@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.

Releasing this in 1.11.0 🎉

Was this page helpful?
0 / 5 - 0 ratings

Related issues

naderghanbari picture naderghanbari  Â·  3Comments

denis-zhdanov picture denis-zhdanov  Â·  3Comments

McKratt picture McKratt  Â·  4Comments

rnorth picture rnorth  Â·  3Comments

aniketbhatnagar picture aniketbhatnagar  Â·  3Comments