We are running some integration tests that require MongoDB running. Unfortunately MongoDB takes about a minute to start on every run. Are there any flags or tricks that could be used to reduce the startup time? We are using testcontainers to provision the db when IT are running.

For example in Cassandra you could reduce the amount of "virtual nodes" in the cluster and do some additional tricks that reduce the startup time from 50-60 seconds to 10-15, without actually sacrificing the ability to test with a 3 or 5 nodes cluster setups (you just can't create very large clusters, but that's not that practical for integration tests anyway so it's a fair trade)

  • When I start a fresh (i.e. no data files) MongoDB on my local computer is takes only 5 seconds. When the data files exist, the it starts in 3 seconds. I have no clue how you come to such statements. Dec 5, 2023 at 20:41
  • By "starts" do you mean from zero to becoming a "healthy" node (in terms of docker / k8s health checks), or just starting the process? :)
    – tftd
    Dec 5, 2023 at 20:53


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.