Comments (3)
Hi @thommy66,
Operating system settings like ulimit
are configured and managed outside of mtools, so you would have to find some instructions specific to the version of macOS you are running. I expect the approach will be the same for either Intel or Apple Silicon CPUs.
mlaunch
is only intended for local test and dev deployments, so if you are working with a larger data set you may find it easier to use Brew to manage a persistent deployment. I believe brew services
wraps launchctl
so it is more straightforward to adjust limits without messing with reboots or csrutil
(which modifies System Integrity Protection settings).
You could also try searching or asking for advice on Ask Different (Stack Exchange for macOS) or perhaps the MongoDB Developer Community Forums.
If you find or create a reasonable set of instructions, please add a comment on this issue with a pointer.
Regards,
Stennie
from mtools.
Hi @stennie
Thanks for the feedback, unfortunately it is not so easy. And there are good reasons, why I use mtools
instead of brew. I did not find a way to start multiple instances of mongod
, each with a separate mongod.conf
file specifing a different port for each node of the ReplicaSet using brew
. So mtools
delivers that flexibilty which made it the right tool for my dev-work.
However, the limitation of 256 open files is definitely a strong limitation. I need a replicaset with the minimal three nodes since I use transactions in MongoDB and want to test and debug them in my IDE. I have only a handful of databases in each node and I cannot execute more than around 50 statements and then the entire setup crashes with "too many files open". This is far away from a 'big installation'.
So I did some more research. I agree with many people in the net, that it is not very wise to change low level system settings such as increasing system wide max file descriptors. It may also slow down the entire machine. Generally the OS is pretty good in managing the resources of the machine... So I guess its better not to use csrutil
etc.
I found something easier which seems to work. I only increased the max number of file descriptors to 8192 for the moment. Seems to be enough for me at the moment. Here is what to do on a MAC computer:
#check the current limits in the shell
ulimit -a
# ATTN: use this folder in the System and NOT in your home folder! You need `sudo` (`root` access) to create and save
# files there
cd /Library/LaunchDaemons
sudo touch limit.maxfiles.plist
# start your editor and then add the following to the above file
# e.g. nano limit.maxfiles.plist or whatever editor you prefer
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxfiles</string>
<string>8192</string>
<string>81920</string>
</array>
<key>RunAtLoad</key>
<true />
<key>ServiceIPC</key>
<false />
</dict>
</plist>
# to save the file you may need to provide the password again.
# REBOOT the computer
After the reboot my ulimit
shows better values for MongoDB:
[LaunchDaemons] ulimit -a
-t: cpu time (seconds) unlimited
-f: file size (blocks) unlimited
-d: data seg size (kbytes) unlimited
-s: stack size (kbytes) 8176
-c: core file size (blocks) 0
-v: address space (kbytes) unlimited
-l: locked-in-memory size (kbytes) unlimited
-u: processes 10666
-n: file descriptors 8192
Maybe this helps somebody else...
from mtools.
Thanks for sharing a solution @thommy66 !
FYI, you can also use a single member replica set for testing transactions in a dev environment.
Regards,
Stennie
from mtools.
Related Issues (20)
- Remove support for legacy SCCC config servers
- Update dependencies and set upper version constraints HOT 1
- Min version of numpy should be 1.21.6 for Python 3.7 compat
- Min version of matplotlib should be 3.5 for Python 3.7 compat
- Move mtools/util/pattern.py tests from inline to Pytest
- `mlaunch init --help` should not require `mongod`
- Passing `--dbpath` to mlaunch causes broken `mongod` invocation
- Fix deprecation warnings for nose-style tests in Pytest 7.2 HOT 1
- Update link for PyMongo installation instructions
- Update url for matplotlib installation
- Different mlogfilter timezone behavior between stdin and file given on CLI
- Default to compact JSON output
- Add mlogfilter --pretty
- mlaunch: can't start process if base path name contains spaces
- mlaunch fails to create a PSA without majority read concern HOT 2
- Add “temporary” mode HOT 2
- M tools
- mlaunch - would it be possible to config a multihost cluster with mlaunch HOT 1
- Remove Python 3.7 (EOL)
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 mtools.