JimHough
Posts: 2
Joined: Fri Jun 08, 2012 10:55 am

Compiling MongoDB for the RasPI

Fri Jun 08, 2012 11:36 am

I am trying to get MongoDB installed on the Debian Squeeze OS.
I am following these instructions http://elsmorian.com/post/24395639198/b ... spberry-pi.
When I get to 'scons' it begins to compile but then I get 'Virtual memory exhausted: Cannot allocate memory'
Do I need to close some things to free up memory?
How do I find what is hogging all the memory?
Thanks

User avatar
RaTTuS
Posts: 10487
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Compiling MongoDB for the RasPI

Fri Jun 08, 2012 12:59 pm

Create an empty file using the dd (device-to-device copy) command: dd if=/dev/zero of=/swap0 bs=1M count=512 # This is for a 512 MB swap space.
Format the file for use as swap: mkswap /swap0
Add the swap file to the system configuration: echo "/swap0 swap swap" >>/etc/fstab
Activate the swap space: swapon -a
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

JimHough
Posts: 2
Joined: Fri Jun 08, 2012 10:55 am

Re: Compiling MongoDB for the RasPI

Sat Jun 09, 2012 8:23 am

Thanks!
This worked great. :)
Is there any problem with leaving the swap file activated? I read that it can reduce the life of your SD card. Is it possible/better to have this file on a USB HDD?

Berglund
Posts: 1
Joined: Sun Jul 08, 2012 5:56 pm

Re: Compiling MongoDB for the RasPI

Sun Jul 08, 2012 6:00 pm

JimHough wrote:Thanks!
This worked great. :)
Is there any problem with leaving the swap file activated? I read that it can reduce the life of your SD card. Is it possible/better to have this file on a USB HDD?
It will reduce the life of the SD-card, but I found this on a different post on the subject:
redman684 wrote:I often see memory that can be written 100,000 times and even claims of over 1,000,000 are made.

Writing an 8 GB card (with perfect wear leveling) 100,000 times with 10 MB/s will take 2.6 years of continuous writing. So it's pretty safe to say the card won't wear out anytime soon, even when used as swap space.
(http://www.raspberrypi.org/phpBB3/viewt ... f=2&t=2813)

valent
Posts: 27
Joined: Mon Jan 30, 2012 9:40 pm

Re: Compiling MongoDB for the RasPI

Mon Jul 30, 2012 10:58 am

But not all SHDC cards have wear-level support, I managed to burn one to the ground with swap partition after only two weeks of usage, so be careful...

valent
Posts: 27
Joined: Mon Jan 30, 2012 9:40 pm

Re: Compiling MongoDB for the RasPI

Mon Jul 30, 2012 12:35 pm

Berglund wrote:
JimHough wrote:
It will reduce the life of the SD-card, but I found this on a different post on the subject:
redman684 wrote:I often see memory that can be written 100,000 times and even claims of over 1,000,000 are made.

Writing an 8 GB card (with perfect wear leveling) 100,000 times with 10 MB/s will take 2.6 years of continuous writing. So it's pretty safe to say the card won't wear out anytime soon, even when used as swap space.
(http://www.raspberrypi.org/phpBB3/viewt ... f=2&t=2813)
Congrats on this great quote, but that logic is flawed.

Issues don't happen when you write big files, like in your example, but when you write bunch of small files! Usually each block in SD card is 4MB in size, so when you write lots of small random files you can reduce time it takes to burn the card by factor of 30 or more.

Please read this great article regarding calculating time it takes to burn down flash memory in SDHC cards: http://www.scribd.com/doc/7010332/SANDI ... r-Leveling

Return to “Troubleshooting”