3 ms·
I'm not sure where your idea about MongoDB taking "an entire server". It will use as much memory as it has available to it, but of course you can run other thin
by mattparlane 13y ago
I'm not sure where your idea about MongoDB taking "an entire server". It will use as much memory as it has available to it, but of course you can run other things alongside it.
I'm currently running PHP, Ruby, Memcache, Postfix, nginx, plus probably a bunch of other stuff I'm forgetting, all on one server and it works fine.
MongoDB can be configured entirely on the command line and is as simple as downloading a binary, unzipping it and running it.
- hoodoof 13y agoMy understanding is that it takes all the available memory - not true?
- mattparlane 13y agoIt uses memory mapped files, which is different from malloc()ing a whole lot of memory. If you do a "top" or whatever, it won't show up as taking a lot of resident memory, but "free" will show it being taken up in the "cached" column. The end result is that it will "use" all available memory on the system, but if you want to run anything else alongside, the kernel will just de-allocate memory from MongoDB and allocate it to other processes. The only downside is that it's not very tuneable -- you are at the mercy of the kernel and its algorithms. In my experience if you have enough memory to hold your "working set" (which has a fairly loose definition), you should be fine. We have also disabled swap on our servers -- I would recommend trying it, but do so carefully, you don't want your database server being OOM'd while serving production traffic. We have 2 DB servers each with 24GB RAM and the whole database is about 90GB but that includes a bunch of logging stuff that is truncated periodically and it's not in our "working set". We are running other processes on the DB servers as well (the ones I mentioned) and everything is running fine.
- hoodoof 13y agoI really liked ReThinkDB. Have you tried it?
- mattparlane 13y agoNo, it wasn't around when we switched to MongoDB. Still doesn't have PHP drivers either. Pretty sure at least one of those answers was worth an upvote...
- coffeemug 13y agoRethinkDB does now have a community supported php driver -- http://danielmewes.github.io/php-rql/ http://danielmewes.github.io/php-rql/
- hoodoof 13y agoAlso I seem to recall major pain writing queries to access substructures/embedded data within JSON when using Mongo. Unless that has changed in the last 12 months?
- mattparlane 13y agoIt is true that it requires a shift to go from AND/OR SQL queries to doing the same thing programatically. I'm not sure anything there has changed in the last 12 months, at least not huge changes. I've found it to be not a huge problem though, and of course MongoDB is definitely one of the most flexible NoSQL databases in terms of querying.