CPU Limits FAQ

This FAQ will help answer any questions you may have about Enforced Resource Allocation on Aptible. Be sure to have a look at the documentation for Container Profiles as well.

Why should I enable Enforced Resource Allocation on my Dedicated Stack?

Without Enforced Resource Allocation, there are a few important implications for Containers deployed on Dedicated Stacks:

  • Your Containers will be allowed to use more CPU than their share.
  • Your Containers may negatively impact other Containers you own if they use too much CPU.

In other words, in the absence of Enforced Resource Allocation, your Containers are granted extra CPU that wasn't allocated to them, but their CPU share is not guaranteed. Conversely, if CPU limits are enabled, your Containers are limited to their resource allocation, but that allocation is guaranteed.

What happens if I don't enable Enforced Resource Allocation on my Stack?

Enable Enforced Resource Allocation!

Aptible strongly recommends enabling Enforced Resource Allocation on existing Dedicated Stacks which do not currently enforce CPU Limits.

Without Enforced Resource Allocation, a container can be starved of CPU by other containers allocated to the same host machine. If another container on the same host exceeds its limit and consumes all available CPU on the host machine, an App can time out, throw errors, and trigger your alerting—obscuring the true root cause of problems with your App!

When an alert is triggered by a sudden increase in load on another Service, a CPU-intensive cron job, or even a bad release of another App on a Stack, it can be difficult to narrow down the true cause of the problem.

Moreover, the underlying events that trigger these types of errors might not be visible to you at all:

  • The Aptible platform may restart containers on different hosts at any time, in response to a host machine failure or scheduled maintenance.
  • Ephemeral SSH Sessions without CPU Limits enabled may cause CPU starvation of Stack resources which are colocated with the bastion host instance—including the NAT Gateway, which will affect all outbound traffic.
  • App host machines may be replaced with larger or smaller machines (typically, a seamless transition), and if the excess CPU capacity an undersized Container was relying on suddenly disappears, it may induce a sudden, inexplicable drop in App performance!

Enforced Resource Allocation prevents these failure modes entirely.

Because there is a risk that Apps without enforced CPU Limits are relying on resources beyond their nominal allocation, transitioning your Dedicated Stacks to Enforced Resource Allocation is not trivial. Before enabling CPU Limits on your existing Dedicated Stacks, ensure that you don't have any critical Apps which rely on CPU beyond their current nominal allocation.

How long does it take to enable Enforced Resource Allocation?

Aptible support can enable this feature typically within a day. There is no downtime.

Is a restart required when changing Container Profiles?

Yes, changing Container Profiles requires restarting the container.

Can I customize the CPU:RAM ratio allocated to my containers?

The number of CPUs per unit of RAM is fixed for each Container Profile.

How do I modify Container Profiles?

To change the Container Profile specified for your App, navigate to the service you would like to scale, then:

  • Select Scale.
  • Choose a Container Profile from the dropdown in the Container Profile section.
  • Click Scale Service to confirm the change.

After a restart, your containers will run the new Container Profile.

How do I enable Enforced Resource Allocation on my Shared Stack?

CPU Limits and Memory Limits are enforced on Shared Stacks by default. It is not possible to disable these Enforced Resource Allocation features on a Shared Stack.

Can I disable Enforced Resource Allocation on my Dedicated Stack?

No, it is not possible to disable Enforced Resource Allocation after it has been enabled. Enforced Resource Allocation is also enabled by default on all new Stacks.

How do I enable Enforced Resource Allocation (CPU Limits) on my Stacks?

Enforced Resource Allocation is automatically enabled on all new Dedicated Stacks.

The historical default for Dedicated Stacks has been to not enforce CPU Limits. This default changed for new Stacks in 2021; now all new Stacks enforce CPU Limits by default. You can check in the Dashboard whether your Stack shows CPU Limits "Enabled" or "Disabled". If you want to enable enforcement, this can be done via a simple request to Aptible Support.

Why haven't CPU Limits been enforced in the past?

These limits have not been enforced in the past to provide surge capacity for individual services within a Dedicated Stack: A lack of CPU Limit enforcement meant that excess CPU capacity on the host machine won't go unused if a container is taxed beyond its allocation. This allowed Containers which required increased resources for a short period to have access to as much processing power as was available on the host machine.


Did this page help you?