How to detect this case: CF-AppMemoryQuo taExceeded


Juan Antonio Breña Moral <bren at juanantonio.info...>
 

Hi,

doing some tests, I detected in my testing environment the following scenario:

Error: the string "{\n \"code\": 100005,\n \"description\": \"You have ex
ceeded your organization's memory limit.\",\n \"error_code\": \"CF-AppMemoryQuo
taExceeded\"\n}\n" was thrown, throw an Error :)

Does exist some REST Call to know if the org/space has reached the limit?

Many thanks in advance

Juan Antonio


Dieu Cao <dcao@...>
 

You can call this end point to retrieve the org memory usage
http://apidocs.cloudfoundry.org/222/organizations/retrieving_organization_memory_usage.html

You would then need to check this against the org quota.

There's a story further down in the backlog for a similar endpoint for
space.

There was a previous PR to add end points that would more clearly show
quota usage for org and space, but it fell through.

-Dieu

On Wed, Oct 21, 2015 at 7:15 AM, Juan Antonio Breña Moral <
bren(a)juanantonio.info> wrote:

Hi,

doing some tests, I detected in my testing environment the following
scenario:

Error: the string "{\n \"code\": 100005,\n \"description\": \"You
have ex
ceeded your organization's memory limit.\",\n \"error_code\":
\"CF-AppMemoryQuo
taExceeded\"\n}\n" was thrown, throw an Error :)

Does exist some REST Call to know if the org/space has reached the limit?

Many thanks in advance

Juan Antonio


Juan Antonio Breña Moral <bren at juanantonio.info...>
 

Hi,

Using this method, I receive the memory used by the organization:

{ memory_usage_in_mb: 576 }

If i use this method:
http://apidocs.cloudfoundry.org/222/organizations/get_organization_summary.html

I receive the same information:

{ guid: '2fcae642-b4b9-4393-89dc-509ece372f7d',
name: 'DevBox',
status: 'active',
spaces:
[ { guid: 'e558b66a-1b9c-4c66-a779-5cf46e3b060c',
name: 'dev',
service_count: 4,
app_count: 2,
mem_dev_total: 576,
mem_prod_total: 0 } ] }

I think that the limit is defined in a Quota definition for Space or an Organization. Using a local instance, I was doing some tests with the methods:
http://apidocs.cloudfoundry.org/222/organization_quota_definitions/delete_a_particular_organization_quota_definition.html

but a organization doesn't require a quota, so I suppose that exist a default quota, is it correct?
In my case, the unique quota is:
http://apidocs.cloudfoundry.org/222/organization_quota_definitions/list_all_organization_quota_definitions.html

[ { metadata:
{ guid: '59ce5f9d-8914-4783-a3dc-8f5f89cf023a',
url: '/v2/quota_definitions/59ce5f9d-8914-4783-a3dc-8f5f89cf023a',
created_at: '2015-07-15T12:32:30Z',
updated_at: null },
entity:
{ name: 'default',
non_basic_services_allowed: true,
total_services: 100,
total_routes: 1000,
memory_limit: 10240,
trial_db_allowed: false,
instance_memory_limit: -1 } } ]
√ The platform returns Quota Definitions from Organizations (359ms)

In Pivotal for example, I suppose that free accounts use the default quota:

{ metadata:
{ guid: 'b72b1acb-ff4f-468d-99c0-05cd91012b62',
url: '/v2/quota_definitions/b72b1acb-ff4f-468d-99c0-05cd91012b62',
created_at: '2013-11-19T18:53:48Z',
updated_at: '2013-11-19T19:34:57Z' },
entity:
{ name: 'trial',
non_basic_services_allowed: false,
total_services: 10,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 2048,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },

But method returns the following quotas.

[ { metadata:
{ guid: '8c4b4554-b43b-4673-ac93-3fc232896f0b',
url: '/v2/quota_definitions/8c4b4554-b43b-4673-ac93-3fc232896f0b',
created_at: '2013-11-19T18:53:48Z',
updated_at: '2013-11-19T19:34:57Z' },
entity:
{ name: 'free',
non_basic_services_allowed: false,
total_services: 0,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 0,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '7dbdcbb7-edb6-4246-a217-2031a75388f7',
url: '/v2/quota_definitions/7dbdcbb7-edb6-4246-a217-2031a75388f7',
created_at: '2013-11-19T18:53:48Z',
updated_at: '2013-11-19T19:34:57Z' },
entity:
{ name: 'paid',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 10240,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '2228e712-7b0c-4b65-899c-0fc599063e35',
url: '/v2/quota_definitions/2228e712-7b0c-4b65-899c-0fc599063e35',
created_at: '2013-11-19T18:53:48Z',
updated_at: '2014-05-07T18:33:19Z' },
entity:
{ name: 'runaway',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 204800,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: 'b72b1acb-ff4f-468d-99c0-05cd91012b62',
url: '/v2/quota_definitions/b72b1acb-ff4f-468d-99c0-05cd91012b62',
created_at: '2013-11-19T18:53:48Z',
updated_at: '2013-11-19T19:34:57Z' },
entity:
{ name: 'trial',
non_basic_services_allowed: false,
total_services: 10,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 2048,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '39d630ba-66d6-4f6d-ba4e-8d45a05e99c4',
url: '/v2/quota_definitions/39d630ba-66d6-4f6d-ba4e-8d45a05e99c4',
created_at: '2014-01-23T20:03:27Z',
updated_at: null },
entity:
{ name: '25GB',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 25600,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '81226624-9e5a-4616-9b9c-6ab14aac2a03',
url: '/v2/quota_definitions/81226624-9e5a-4616-9b9c-6ab14aac2a03',
created_at: '2014-03-11T00:13:21Z',
updated_at: '2014-03-19T17:36:32Z' },
entity:
{ name: '25GB:30free',
non_basic_services_allowed: false,
total_services: 30,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 25600,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '0e7e2da4-0c74-4039-bdda-5cb575bf3c85',
url: '/v2/quota_definitions/0e7e2da4-0c74-4039-bdda-5cb575bf3c85',
created_at: '2014-05-08T03:56:31Z',
updated_at: null },
entity:
{ name: '50GB',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 51200,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: 'e9473dc8-7c84-401c-88b2-ad61fc13e33d',
url: '/v2/quota_definitions/e9473dc8-7c84-401c-88b2-ad61fc13e33d',
created_at: '2014-05-08T03:57:42Z',
updated_at: null },
entity:
{ name: '100GB',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 102400,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '21577e73-0f16-48fc-9bb5-2b30a77731ae',
url: '/v2/quota_definitions/21577e73-0f16-48fc-9bb5-2b30a77731ae',
created_at: '2014-05-08T04:00:28Z',
updated_at: null },
entity:
{ name: '75GB',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 76800,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '6413dedd-5c1e-4b18-ac69-e87bbaf0bfdd',
url: '/v2/quota_definitions/6413dedd-5c1e-4b18-ac69-e87bbaf0bfdd',
created_at: '2014-05-13T18:18:18Z',
updated_at: null },
entity:
{ name: '100GB:50free',
non_basic_services_allowed: false,
total_services: 50,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 102400,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '9d078b97-0dab-4563-aea5-852b1fb50129',
url: '/v2/quota_definitions/9d078b97-0dab-4563-aea5-852b1fb50129',
created_at: '2014-09-11T02:32:49Z',
updated_at: null },
entity:
{ name: '10GB:30free',
non_basic_services_allowed: false,
total_services: 30,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 10240,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '851c99c6-7bb3-400f-80a0-a06962e0c5d3',
url: '/v2/quota_definitions/851c99c6-7bb3-400f-80a0-a06962e0c5d3',
created_at: '2014-10-31T17:10:53Z',
updated_at: '2014-11-04T23:53:50Z' },
entity:
{ name: '25GB:100free',
non_basic_services_allowed: false,
total_services: 100,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 25600,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '5ad22d2c-1519-4e17-b555-f702fb38417e',
url: '/v2/quota_definitions/5ad22d2c-1519-4e17-b555-f702fb38417e',
created_at: '2015-02-02T22:18:44Z',
updated_at: '2015-04-22T00:36:14Z' },
entity:
{ name: 'PCF-H',
non_basic_services_allowed: true,
total_services: 1000,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 204800,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: 'cf04086c-ccf9-442c-b89a-3f3fbcd365e3',
url: '/v2/quota_definitions/cf04086c-ccf9-442c-b89a-3f3fbcd365e3',
created_at: '2015-05-04T19:20:47Z',
updated_at: '2015-05-04T19:26:14Z' },
entity:
{ name: 'oreilly',
non_basic_services_allowed: true,
total_services: 10000,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 307200,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } } ]
√ The platform returns Quota Definitions from Organizations (720ms)

I suppose that the best practice is to define an organization a determinated quota.
How to set a Quota as default?
How to configurate?

Juan Antonio


Dieu Cao <dcao@...>
 

The default org quota you're seeing is defined here [1]
I believe you can configure it by specifying the name of the quota you
would like to have as the default quota in your manifest.
For example:

properties:
cc:
default_quota_definition: turtle
quota_definitions:
turtle:
memory_limit: 10240
total_services: -1
total_routes: 1000
non_basic_services_allowed: true


[1]
https://github.com/cloudfoundry/cloud_controller_ng/blob/master/config/cloud_controller.yml#L102-L107

On Thu, Oct 22, 2015 at 3:48 AM, Juan Antonio Breña Moral <
bren(a)juanantonio.info> wrote:

Hi,

Using this method, I receive the memory used by the organization:

{ memory_usage_in_mb: 576 }

If i use this method:

http://apidocs.cloudfoundry.org/222/organizations/get_organization_summary.html

I receive the same information:

{ guid: '2fcae642-b4b9-4393-89dc-509ece372f7d',
name: 'DevBox',
status: 'active',
spaces:
[ { guid: 'e558b66a-1b9c-4c66-a779-5cf46e3b060c',
name: 'dev',
service_count: 4,
app_count: 2,
mem_dev_total: 576,
mem_prod_total: 0 } ] }

I think that the limit is defined in a Quota definition for Space or an
Organization. Using a local instance, I was doing some tests with the
methods:

http://apidocs.cloudfoundry.org/222/organization_quota_definitions/delete_a_particular_organization_quota_definition.html

but a organization doesn't require a quota, so I suppose that exist a
default quota, is it correct?
In my case, the unique quota is:

http://apidocs.cloudfoundry.org/222/organization_quota_definitions/list_all_organization_quota_definitions.html

[ { metadata:
{ guid: '59ce5f9d-8914-4783-a3dc-8f5f89cf023a',
url: '/v2/quota_definitions/59ce5f9d-8914-4783-a3dc-8f5f89cf023a',
created_at: '2015-07-15T12:32:30Z',
updated_at: null },
entity:
{ name: 'default',
non_basic_services_allowed: true,
total_services: 100,
total_routes: 1000,
memory_limit: 10240,
trial_db_allowed: false,
instance_memory_limit: -1 } } ]
√ The platform returns Quota Definitions from Organizations (359ms)

In Pivotal for example, I suppose that free accounts use the default quota:

{ metadata:
{ guid: 'b72b1acb-ff4f-468d-99c0-05cd91012b62',
url: '/v2/quota_definitions/b72b1acb-ff4f-468d-99c0-05cd91012b62',
created_at: '2013-11-19T18:53:48Z',
updated_at: '2013-11-19T19:34:57Z' },
entity:
{ name: 'trial',
non_basic_services_allowed: false,
total_services: 10,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 2048,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },

But method returns the following quotas.

[ { metadata:
{ guid: '8c4b4554-b43b-4673-ac93-3fc232896f0b',
url: '/v2/quota_definitions/8c4b4554-b43b-4673-ac93-3fc232896f0b',
created_at: '2013-11-19T18:53:48Z',
updated_at: '2013-11-19T19:34:57Z' },
entity:
{ name: 'free',
non_basic_services_allowed: false,
total_services: 0,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 0,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '7dbdcbb7-edb6-4246-a217-2031a75388f7',
url: '/v2/quota_definitions/7dbdcbb7-edb6-4246-a217-2031a75388f7',
created_at: '2013-11-19T18:53:48Z',
updated_at: '2013-11-19T19:34:57Z' },
entity:
{ name: 'paid',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 10240,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '2228e712-7b0c-4b65-899c-0fc599063e35',
url: '/v2/quota_definitions/2228e712-7b0c-4b65-899c-0fc599063e35',
created_at: '2013-11-19T18:53:48Z',
updated_at: '2014-05-07T18:33:19Z' },
entity:
{ name: 'runaway',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 204800,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: 'b72b1acb-ff4f-468d-99c0-05cd91012b62',
url: '/v2/quota_definitions/b72b1acb-ff4f-468d-99c0-05cd91012b62',
created_at: '2013-11-19T18:53:48Z',
updated_at: '2013-11-19T19:34:57Z' },
entity:
{ name: 'trial',
non_basic_services_allowed: false,
total_services: 10,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 2048,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '39d630ba-66d6-4f6d-ba4e-8d45a05e99c4',
url: '/v2/quota_definitions/39d630ba-66d6-4f6d-ba4e-8d45a05e99c4',
created_at: '2014-01-23T20:03:27Z',
updated_at: null },
entity:
{ name: '25GB',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 25600,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '81226624-9e5a-4616-9b9c-6ab14aac2a03',
url: '/v2/quota_definitions/81226624-9e5a-4616-9b9c-6ab14aac2a03',
created_at: '2014-03-11T00:13:21Z',
updated_at: '2014-03-19T17:36:32Z' },
entity:
{ name: '25GB:30free',
non_basic_services_allowed: false,
total_services: 30,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 25600,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '0e7e2da4-0c74-4039-bdda-5cb575bf3c85',
url: '/v2/quota_definitions/0e7e2da4-0c74-4039-bdda-5cb575bf3c85',
created_at: '2014-05-08T03:56:31Z',
updated_at: null },
entity:
{ name: '50GB',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 51200,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: 'e9473dc8-7c84-401c-88b2-ad61fc13e33d',
url: '/v2/quota_definitions/e9473dc8-7c84-401c-88b2-ad61fc13e33d',
created_at: '2014-05-08T03:57:42Z',
updated_at: null },
entity:
{ name: '100GB',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 102400,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '21577e73-0f16-48fc-9bb5-2b30a77731ae',
url: '/v2/quota_definitions/21577e73-0f16-48fc-9bb5-2b30a77731ae',
created_at: '2014-05-08T04:00:28Z',
updated_at: null },
entity:
{ name: '75GB',
non_basic_services_allowed: true,
total_services: -1,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 76800,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '6413dedd-5c1e-4b18-ac69-e87bbaf0bfdd',
url: '/v2/quota_definitions/6413dedd-5c1e-4b18-ac69-e87bbaf0bfdd',
created_at: '2014-05-13T18:18:18Z',
updated_at: null },
entity:
{ name: '100GB:50free',
non_basic_services_allowed: false,
total_services: 50,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 102400,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '9d078b97-0dab-4563-aea5-852b1fb50129',
url: '/v2/quota_definitions/9d078b97-0dab-4563-aea5-852b1fb50129',
created_at: '2014-09-11T02:32:49Z',
updated_at: null },
entity:
{ name: '10GB:30free',
non_basic_services_allowed: false,
total_services: 30,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 10240,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '851c99c6-7bb3-400f-80a0-a06962e0c5d3',
url: '/v2/quota_definitions/851c99c6-7bb3-400f-80a0-a06962e0c5d3',
created_at: '2014-10-31T17:10:53Z',
updated_at: '2014-11-04T23:53:50Z' },
entity:
{ name: '25GB:100free',
non_basic_services_allowed: false,
total_services: 100,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 25600,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: '5ad22d2c-1519-4e17-b555-f702fb38417e',
url: '/v2/quota_definitions/5ad22d2c-1519-4e17-b555-f702fb38417e',
created_at: '2015-02-02T22:18:44Z',
updated_at: '2015-04-22T00:36:14Z' },
entity:
{ name: 'PCF-H',
non_basic_services_allowed: true,
total_services: 1000,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 204800,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } },
{ metadata:
{ guid: 'cf04086c-ccf9-442c-b89a-3f3fbcd365e3',
url: '/v2/quota_definitions/cf04086c-ccf9-442c-b89a-3f3fbcd365e3',
created_at: '2015-05-04T19:20:47Z',
updated_at: '2015-05-04T19:26:14Z' },
entity:
{ name: 'oreilly',
non_basic_services_allowed: true,
total_services: 10000,
total_routes: 1000,
total_private_domains: -1,
memory_limit: 307200,
trial_db_allowed: false,
instance_memory_limit: -1,
app_instance_limit: -1 } } ]
√ The platform returns Quota Definitions from Organizations (720ms)

I suppose that the best practice is to define an organization a
determinated quota.
How to set a Quota as default?
How to configurate?

Juan Antonio