Skip to content

Insufficient resources on memory #434

@nsharmacovs

Description

@nsharmacovs

Summary

We have a custom autoscaling job which scales the VM based on memory consumption.
We are calculating the used memory and based on the output of "free -m" which matches with the output of bosh vm --vitals .

Today our scaling job scaled down the VMS. Even though we had enough capacity in term of memory the application started complaining about insufficient memory when starting up on remaining VMs.

I would like to understand how Available memory in REP is calculated by Diego.

I came across https://github.com/cloudfoundry/rep/blob/320f5e9ff0ba2a7bb1294927cbe31ce5af40c987/resources.go#L63-L68

func (c *CellState) ResourceMatch(res *Resource) error {
switch {
case !c.MatchRootFS(res.RootFs):
return ErrorIncompatibleRootfs
case c.AvailableResources.MemoryMB < res.MemoryMB:
return ErrorInsufficientResources
case c.AvailableResources.DiskMB < res.DiskMB:
return ErrorInsufficientResources
case c.AvailableResources.Containers < 1:
return ErrorInsufficientResources
default:
return nil
}
}
It looks like the data is fetched using curl http://10.96.166.55:1800/state Which provides me with
AvailableResources":
{"MemoryMB":0,"DiskMB":139264,"Containers":237},"TotalResources":{"MemoryMB":30720,"DiskMB":163840,"Containers":249}

When I execute bosh VMS --vitals I am getting

| vp_diego_cell_internal_stack_red_z1/1 (9bab400f-0848-4fd4-98cf-116a5360269a) | running | n/a | runner_z1 | 10.96.166.55 | 0.30, 0.30, 0.36 | 0.6% | 0.1% | 0.0% | 72% (21.7G) | 2% (576.2M) | 39% | 47% | 0% |

On the VM i have
vp_diego_cell_internal_stack_red_z1/9bab400f-0848-4fd4-98cf-116a5360269a:~$ free -m
total used free shared buffers cached
Mem: 30662 30336 325 1 1741 6381
-/+ buffers/cache: 22212 8449
Swap: 30663 576 30086

i should be able to push an application of 4 GB easily based on VM capacity.

[Describe the result that you expected to happen.]
I should not get insufficient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions