Openstack: memory overcommit
I couple of days ago I noticed that I never tested the overcommit capability in OpenStack
The default behavior of the Scheduler is to have a look at the database record of each compute node and elect the one which will run the new requested instance. Extract of a compute node record:
mysql> SELECT * FROM compute_nodes \G;
The Scheduler looks at the
free_ram_mb, you might already have notice that I use the overcommit. Basically if you have a
free_ram_mb of 400 and if you want to run a new m1.tiny instance with 512M of memory, the Scheduler will end up with this message in the logs:
WARNING nova.scheduler.manager Failed to schedule_run_instance: No valid host was found. WARNING nova.scheduler.manager Setting instance 53ebe074-8545-4539-a53d-d913450bf716 to ERROR state.
Usually to manage the overcommitment you can use both options:
cpu_allocation_ratio. Default value: 16:1
ram_allocation_ratio. Default value: 1.5:1
Actually there is a bug in the
ram_allocation_ratio as reported on launchpad.
The solution is really simple, of course if you know it. Add this option to your
nova.conf, on the host where runs your nova-scheduler:
Here we just told the Scheduler to only use the
A little more explanations now. By default overcommiting is disable which is fair for Cloud provider. Thanks to this, they are sure to provide the service for what the customers pay. That’s the ideal scenario of course… Now if you run a corporation cloud you definitely want to enable memory overcommit on your compute node.
Overcommitting is not new but it’s a really important feature that you don’t want to miss for your production environment. Hope it helps! ;)
ps: I just saw that the Official OpenStack documentation wrote about this issue. I hate paraphrasing information but the article was already written :).