0

Can you tell me how is it possible to start mongodb in an isolated enviroment with limited resources?

Mongod keeps filling all my RAM so I would like to restrict it.

I am thinking about a linux container like LXC.

Can you give me an example of how to do that?

Thanks

Giorgos Komnino
  • 433
  • 1
  • 7
  • 20
  • 1
    You could use ulimit on the user that runs MongoDB, you can see here for a guide on recommend ulimit settings: http://docs.mongodb.org/manual/administration/ulimit/ however by "filling all my RAM" do you mean 100%? That sounds wrong if so, MongoDB will try and take as much as possible but it most likely isn't actually using that much and also since the OS does the memory management MongoDB will subside should you need to open another program. – Sammaye Nov 29 '12 at 09:13
  • 1
    MongoDB uses RAM for instant access of the data... if it's using up all your ram it means you have too much data (size) in your mongoDB database, in comparison to your available system ram. do know that by restricting mongoDB's RAM usage you'll be dropping it's efficiency at providing you with that data in a fast manner (since it'll have to read from the HDD) – Gonçalo Vieira Nov 29 '12 at 09:19
  • Yes I have 2-3TB of data. It uses all the available RAM for caching. I do not need to access the data. For now I am just inserting to the db. Of course perfomance is an issue but first I would like my system to be stable and not uses swap all the time. – Giorgos Komnino Nov 29 '12 at 09:44
  • You can use ulimit on that so long as you don't care about the degrading performance. – Sammaye Nov 29 '12 at 15:23
  • @Sammaye I have a server with 160GB of RAM. The data I am storing to mongodb are 3TB. I am thinking of giving 60GB of the RAM to mongodb. How this will affect perfomance? 160GB compared to 3TB is relatively small so the 60GB. – Giorgos Komnino Nov 30 '12 at 08:11
  • I cannot answer without knowing your working set size, if you know your working set size (which is normally a lot lower than your data size) then you know how much RAM you really need. Say your working set size of 165GB, degrading to 60GB will make a lot more page faults for a lot more queries, I cannot give you exact data unfortunately. – Sammaye Nov 30 '12 at 08:13
  • @Sammaye : What you mean by working set? I am currently only inserting into mongodb. So can I limit the memory? – Giorgos Komnino Nov 30 '12 at 08:48
  • 1
    http://en.wikipedia.org/wiki/Working_set basically it means, how much data you need in LRU at any given time to ensure maximum performance? That is essentially what it comes down to, but yes you can reduce memory but as to the effects it will give, I cannot answer; but since you don't care about performance atm only stability I would say you shouldn't worry too much unless this is a production server and it is actively being used by outside individuals. – Sammaye Nov 30 '12 at 08:51
  • Thanks. I opened a new question about perfomance http://stackoverflow.com/questions/13642217/mongodb-speed-decrease . But stability is the most important – Giorgos Komnino Nov 30 '12 at 09:25

0 Answers0