Sunday, November 6, 2011

Micro Cloud Foundry – Increasing Default Memory Limits

I attended my first SpringOne a few weeks ago in my former hometown Chicago.  It was a very fun event with lots of energy around the Spring community as well as they Groovy and Grails crowd.  Cloud Foundry topics took center stage with many standing-room-only sessions and lots of people coming up to the booth.  All attendees received their very own copy of Micro Cloud Foundry as part of their conference paraphernalia on a USB stick inside the black binder.  Micro Cloud Foundry is a Virtual Machine that lets developers have a complete Cloud Foundry instance on their laptop.  This is great because you can develop locally and be confident that your application will run the same on cloudfoundry.com or another instance.  There are some great resources for getting started with Micro Cloud Foundry including Josh Long’s screencast and a Getting Started guide written by Charles Lee.  Micro Cloud Foundry defaults to a 1GB Virtual Machine, which limits the number of applications and the amount of memory per application to 1GB.  The Java and Spring application profiles default to 512MB, which is only 2 applications with the default settings.  I had a question from someone who walked up to the booth whether the memory limits could be increased.  Since Cloud Foundry guru Dave McCrory was close by I got a tip to simply boost the memory for the VM and  reconfigure using the console menu.  I tried it on my laptop since I’m lucky enough to have 8GB of RAM and it worked well.  Below are the steps.

Just need the punchline?

 

got micro #cloudfoundry to use up to 2GB of memory (1GB is default), stop mcf, change vm mem setting, start vm, menu option thanks @mccrory
Oct 26 via webFavoriteRetweetReply

 

The detailed steps

Micro Cloud Foundry has a text based interface, and if you select  “help” you can see the defaults.  There is also a Knowledge Base article describing resource limits on support.cloudfoundry.com.

Screen Shot 2011-11-06 at 9.30.02 AM

You can validate your Micro Cloud Foundry VM settings by using the vcap command line interface, here is where I start:

memoryToStart

So now you can stop your Micro Cloud Foundry VM, preferably through the text command interface so the VM shuts down properly.  Once the VM has been shutdown, you will be able to edit the memory settings by selecting Processors & RAM as shown below.  You cannot edit the memory settings while the VM is running.

Screen Shot 2011-11-06 at 9.57.44 AM

Now change the value from 1024 MB to 2048 MB.

Screen Shot 2011-11-06 at 9.58.22 AM

After restarting the VM with the larger memory settings, the Micro Cloud Foundry interface should detect that the memory settings need to be reconfigured and that should be shown with red text, so select that command.

Screen Shot 2011-11-06 at 9.58.53 AM

Follow the instructions in the console and when the services finish coming up again a few moments later, you can reissue the “vmc info” command and hopefully see the new higher memory limit in the response.

memoryToEnd