开发者

Is it ideal that MongoDB is using 150 MB memory?

This is the first project by me which is using MongoDB.

I have hosted it on a linode (a VPS which uses XEN) and I'm checking memory usage with "top".

The mongod process seem to use around 150 MB of memory. There were no connections to it when I checked. I use RockMongo to administer it. My main database stats are -

Size - 464m 
Storage Size - 83.99m
Data Size - 66.4m
Index Size - 49.33m
Collections - 5
Objects - 584850

A lot of queries happen when the cron job is running, around 75 per minute or even more. But, as I said earlier, when I checked the memory usage, there were no connections.

Output of db.serverStatus();

Note - I had restarted mongod before running db.serverStatus(); and the memory usage was 40 MB.

{
   "retval": {
     "version": "1.6.5",
     "uptime": 790,
     "uptimeEstimate": 783,
     "localTime": "Mon, 07 Feb 2011 00: 51: 04 -0500",
     "globalLock": {
       "totalTime": 790027671,
       "lockTime": 376381,
       "ratio": 0.00047641495838188,
       "currentQueue": {
         "total": 0,
         "readers": 0,
         "writers": 0
      }
    },
     "mem": {
       "bits": 64,
       "resident": 38,
       "virtual": 957,
       "supported": true,
       "mapped": 288
    },
     "connections": {
       "current": 2,
       "available": 9598
    },
     "extra_info": {
       "note": "fields vary by platform",
       "heap_usage_bytes": 152448,
       "page_faults": 0
    },
     "indexCounters": {
       "btree": {
         "accesses": 1,
         "hits": 1,
         "misses": 0,
         "resets": 0,
         "missRatio": 0
      }
    },
     "backgroundFlushing": {
       "flushes": 13,
       "total_ms": 1,
       "average_ms": 0.076923076923077,
       "last_ms": 0,
       "last_finished": "Mon, 07 Feb 2011 00: 50: 54 -0500"
    },
     "cursors": {
       "totalOpen": 0,
       "clientCursors_siz开发者_JAVA技巧e": 0,
       "timedOut": 0
    },
     "opcounters": {
       "insert": 0,
       "query": 57,
       "update": 0,
       "delete": 0,
       "getmore": 0,
       "command": 46
    },
     "asserts": {
       "regular": 0,
       "warning": 0,
       "msg": 0,
       "user": 0,
       "rollovers": 0
    },
     "ok": 1
  },
   "ok": 1
}

A friend of mine runs his WordPress blog on a linode with same amount of ram (1024 MB). His MySQL usage show mere 20.48 and approx. 12 users are like "always-surfing" (as in always-on) on his site.

This makes me feel MongoDB isn't a nice choice for me and I should have sticked to MySQL!

Thank you, all.


"Using" that much memory isn't as bad as it seems ... MongoDB will (at least seem to) use up a lot of available memory, but it leaves it up to the OS's VMM to tell it to release the memory when need. (see Caching in the MongoDB docs.)

For the most part it's "using" that memory for cache, which dramatically speeds things up.

You should be able to release any and all memory by restarting MongoDB.

However, to some extent MongoDB isn't really actively "using" the memory ... read on for a lot more details in this anwser ..

How to release the caching which is used by Mongodb?


Memory management is soley up to the OS.

Read

http://blog.mongodb.org/post/101911655/mongo-db-memory-usage

There is basically no way right now to influence the memory usage....and mentioned: learn about memory-mapped files and don't mix up the memory usage of memory mapped files with the actual memory usage.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜