Random thoughts & observations

From the mundane to the profound and everything in between here’s what’s rocking our world

Increasing MongoDB soft rlimits on Mac OS X

Posted: May 18, 2015
Written by: Saints At Play
Category: MongoDB

If you've installed MongoDB on Mac OS X (and this will more than likely be applicable to similar UNIX based systems such as Linux) you may be greeted with the following warning when running the mongo daemon process in your Terminal application:

** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000

Looks a little cryptic doesn't it? Let's take a look at what this means and how to fix it...

It's all about resources

With most UNIX based OS's system resources such as network connections, files and threads are limited and controlled on a per-process and per-user basis. Known as "ulimits" these controls and limitations prevent excessive consumption of system resources by a single user.

Generally, for development purposes, if these limits are low they won't cause any problems with the functioning and usage of MongoDB. The exception to this would be if you needed to work with a large number of files or connections.

That said it's a good idea to resolve those low limits as it helps ready your database for any potential increase in requirements (say for a new project with larger datasets).

Fixing that warning

Increasing those limits is easily done with the following command issued in your Terminal application (but be sure to exit the mongo shell first with CTRL + C):

ulimit -n 1024

What the above command does it to set the per user limitation for file descriptors on both hard and soft limits. Hard limits refer to the absolute maximum number of processes that a user can have active at any single time while soft limits refer to the limit that is enforced for a session or process.

If you'd like to learn more about working with ulimits you can view the following page concerning managing system resources for MongoDB.

Now, if you run the mongo daemon process you should no longer be confronted with that warning concerning soft rlimits being too low.

« Return to Posts



July 30, 2015

Hi there, just wanted to mention, I enjoyed this blog post.
It was helpful. Keep on posting!


July 29, 2015

Hello there! This is my first visit to your blog!
We are a team of volunteers and starting a new project
in a community in the same niche. Your blog provided us beneficial information to work
on. You have done a marvellous job!


July 19, 2015

Does your site have a contact page? I'm having problems locating
it but, I'd like to send you an e-mail. I've got some ideas for your blog you might be interested in hearing.

Either way, great site and I look forward to seeing it grow over


July 14, 2015

Heya this is kinda of off topic but I was wondering if blogs use WYSIWYG editors or if you have to
manually code with HTML. I'm starting a blog soon but have no coding skills
so I wanted to get guidance from someone with experience.
Any help would be greatly appreciated!

Local Seo Services In Elk Grove

May 24, 2015

you're really a goodd webmaster. The web site loading velocity is incredible.
It seems that you are doing any unique trick.

In addition, The contents are masterpiece. you've performed a magnifficent process on ths

Posting comments after three months has been disabled.