Re: diego questions: default memory and passing env variables


Amit Kumar Gupta
 

This is not a environment variable you can set. To scale down the memory
allocated to your instances, do

cf scale <app-name> -m 1024M

This will tell Warden/Garden to allocate that much memory to your
containers and kill them if they exceed it. The documentation is saying
that the processes running inside the container can learn about the memory
limit applied to them via the environment variable MEMORY_LIMIT. If you
try to set this variable via set-env, it will get overwritten by the value
set by "cf scale". Again, the MEMORY_LIMIT environment variable doesn't do
anything, it's just information passed into the container via the process's
environment. To actually constrain the memory, use "cf scale" or set it in
your manifest file:

https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#memory

On Wed, Sep 2, 2015 at 3:08 PM, Siva Balan <mailsiva(a)gmail.com> wrote:

We are not using Diego and we are on CF version 211.
I had my application started with 2GB of memory set in the manifest file.
I then ran the following command and restaged the app:
cf set-env <app-name> MEMORY_LIMIT 1024m
Then when I ran "cf app <app-name>", it was still showing the instance
memory of 2GB but the heap size allocated to the application was cut in
half and I confirmed this through New Relic app. Also, the first full GC of
the app occurred when the memory of the instance was at 1.3GB. So I am not
quite sure of the description of the MEMORY_LIMIT env variable as described
in
http://docs.run.pivotal.io/devguide/deploy-apps/environment-variable.html#memory.
I did not see my application restart when the instance memory went over
1GB.
Any ideas about this behavior?

Thanks.
Siva

On Tue, Sep 1, 2015 at 7:40 PM, Amit Gupta <agupta(a)pivotal.io> wrote:

Responses inline.

On Tue, Sep 1, 2015 at 7:13 PM, Tom Sherrod <tom.sherrod(a)gmail.com>
wrote:

What is the default memory size of an app deployed in diego? cf apps
indicate 1GB.
Yes. This isn't a diego thing, this is a CC thing.


cf set-env doesn't appear to be getting the environment variable
information to the running container. Is cf set-env the correct method to
use?
You likely need to restage the application for ENV var changes to take
effect. Unless I'm mistaken, this too is not diego-specific, and applies
to DEA containers as well.


Thanks!
Tom
Best,
Amit

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.