Comments (6)
@hhorak @praiskup @pkubatrh Does setting limits
also apply to MariaDB/PostgreSQL? Is it somehow handled in RHSCL images?
from mongodb-container.
Ulimits on RHEL/Fedora systems are usually generous enough by default (at least from PostgreSQL POV).
from mongodb-container.
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.
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.
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.
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)
- Create StatefulSet deployment for PostgreSQL HOT 2
- Replication support HOT 1
- erroneous error message when specifying admin password and a database name HOT 3
- Having an external route for mongo HOT 10
- Using this for production apps? HOT 5
- Deploying with glusterfs storage volume HOT 2
- run-mongod ignores rest of arguments HOT 1
- petset-replicas - unclear shutdown HOT 6
- Document how to back-up data from container HOT 2
- Provide example, test and doc for using own SSL cert HOT 1
- connecting as admin via gui HOT 2
- Support for journaling HOT 3
- Regression introduce with restarting slave pods with PVs HOT 3
- Publish Mongodb 4 image HOT 5
- First replica set member is not adding to existing replica set after failure HOT 5
- PVC with replicas HOT 2
- Exception in NodeJS app when new version deployed HOT 1
- OpenShift InstantiateTemplate is not generating admin password HOT 1
- MongoDB images newer than 3.6? HOT 2
- upgrade to v > 4.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongodb-container.