GithubHelp home page GithubHelp logo

Comments (6)

omron93 avatar omron93 commented on June 12, 2024

@hhorak @praiskup @pkubatrh Does setting limits also apply to MariaDB/PostgreSQL? Is it somehow handled in RHSCL images?

from mongodb-container.

praiskup avatar praiskup commented on June 12, 2024

Ulimits on RHEL/Fedora systems are usually generous enough by default (at least from PostgreSQL POV).

from mongodb-container.

praiskup avatar praiskup commented on June 12, 2024

Roughly tried to run ulimit on my box, and it seems that from mongo perspective only the max number of opened file descriptor issue (default is 1024, so far I haven't seen different different default, while mongo suggest to have 64k, which sounds crazy TBH).

from mongodb-container.

praiskup avatar praiskup commented on June 12, 2024

Btw., there seems to be soft limit of 4096 simultaneously opened file descriptors per process on my box. I've seen some weird scenarios (GNU tar archives very deep directory structure) where the default 1024 limit is approached .. but I'm curious whether this is really an issue in case of mongodb and why.

from mongodb-container.

omron93 avatar omron93 commented on June 12, 2024

Not sure if it good, but it seems that limits are not set in a image, but are related to host machine. So it may differ on every machine...
It is possible to set defaults in docker daemon by using --default-ulimit ("If these defaults are not set, ulimit settings will be inherited, if not set on docker run, from the Docker daemon." - https://docs.docker.com/engine/reference/commandline/dockerd/).

In case that other database images are not setting this, using defaults from docker daemon seems enough IMPOV.

from mongodb-container.

omron93 avatar omron93 commented on June 12, 2024

Although the fix is relatively simple, I would let setting of limits to the user (when invoking docker run or centrally to docker daemon). So closing this issue now. It could be fixed when this decision cause any problem to someone.

Proposed fix:

diff --git a/3.2/root/usr/bin/run-mongod b/3.2/root/usr/bin/run-mongod
index 2814661..96cca13 100755
--- a/3.2/root/usr/bin/run-mongod
+++ b/3.2/root/usr/bin/run-mongod
@@ -68,4 +68,5 @@ wait_for_mongo_down
 
 # Make sure env variables don't propagate to mongod process.
 unset MONGODB_USER MONGODB_PASSWORD MONGODB_DATABASE MONGODB_ADMIN_PASSWORD
+setup_soft_limits
 exec mongod $mongo_common_args --auth
diff --git a/3.2/root/usr/bin/run-mongod-replication b/3.2/root/usr/bin/run-mongod-replication
index 7c86615..31e1a3c 100755
--- a/3.2/root/usr/bin/run-mongod-replication
+++ b/3.2/root/usr/bin/run-mongod-replication
@@ -69,5 +69,6 @@ ${CONTAINER_SCRIPTS_PATH}/init-replset.sh &
 
 # Make sure env variables don't propagate to mongod process.
 unset MONGODB_USER MONGODB_PASSWORD MONGODB_DATABASE MONGODB_ADMIN_PASSWORD
-mongod ${mongo_common_args} --replSet "${MONGODB_REPLICA_NAME}" &
+(setup_soft_limits;
+mongod ${mongo_common_args} --replSet "${MONGODB_REPLICA_NAME}") &
 wait
diff --git a/3.2/root/usr/share/container-scripts/mongodb/common.sh b/3.2/root/usr/share/container-scripts/mongodb/common.sh
index 4d35a0d..b023d9d 100644
--- a/3.2/root/usr/share/container-scripts/mongodb/common.sh
+++ b/3.2/root/usr/share/container-scripts/mongodb/common.sh
@@ -177,6 +177,14 @@ function setup_default_datadir() {
   fi
 }
 
+# setup_soft_limits sets soft limits to maximum (hard limit)
+function setup_soft_limits() {
+  info "Setting soft limits to maximum"
+  for x in c d e f i l m n q r s t u v x; do
+    ulimit -S${x} $(ulimit -H${x})
+  done
+}
+
 # info prints a message prefixed by date and time.
 function info() {
   printf "=> [%s] %s\n" "$(date +'%a %b %d %T')" "$*"

from mongodb-container.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.