Container Resources
Cycle offers flexible management of CPU and RAM resources for containers, allowing users to define resource allocation policies that work seamlessly across different servers, data centers, and cloud providers.
Reserves vs Limits
Cycle distinguishes between reserves and limits when discussing resources.
- Reserves are resources that have been set aside and taken out of the total pool available on the server or within the cluster.
- Limits are the maximum of a resource that an instance CAN consume, but doesn't necessarily have those resources set aside.
Servers and clusters have a maximum amount of resources (CPU shares, RAM) that each instance deployed counts toward. When the usage for a server is maxed out, instances will no longer be deployed to that server by the platform. When a cluster is maxed out, no more instances can be deployed to the cluster, and an error will occur.
CPU Resource Management
Cycle manages CPU resources using a system of CPU shares, where every thread or virtual CPU core is valued at 10 shares. This allows for a granular allocation of CPU resources to individual containers, helping balance workloads effectively across the infrastructure.
Bare Metal and Virtualization Differences
CPU Shares
Bare metal servers come with access to non-virtualized cores. Bare metal servers that support hyperthreading, will have 2 threads per core. This equates to 20 shares per core or 10 shares per thread.
A VM with virtualized cores will have 10 shares per virtualized core, as a virtualized core is almost always synonymous to a thread on the underlying server.
Pinning
Bare metal servers that support hyperthreading have 2 threads per core. In container configuration, pinning is expressed as threads or virtualized cores. For a hyperthreaded bare metal core, use the thread range 0-n, where n is the total number of threads on that core minus 1.
Example:
- 0 for specifically the first thread
- 1 for specifically the second thread
- 0-11 for the first 12 threads
- 1-3 for the 2nd through 4th thread
- 2-x for all threads except the first
In a mixed-infrastructure cluster, where servers may have different numbers of threads, it may be desired to set a range that includes the range of threads available on the specific server the instance is deployed to. In that case, the syntax 2-x is used, which would exclude thread 1, but include all other threads on the system.
Server and Cluster Reserves
When a user creates a container instance resource it is assigned a reserve of 2 CPU shares by default. The reserve is saying "set aside 0.2 CPU specifically for this instance". These shares contribute to the total resource consumption of the server and cluster in which the container is deployed.
Info
The VPN service container and deprecated container instances do not count toward the total usage of the cluster.
Overcommitting CPU Resources
Cycle supports CPU overcommitting, allowing users to allocate more CPU shares than otherwise possible. When overcommitting, the system acts as though there are more CPU cores than physically exist. For example, setting a 2x overcommit ratio would make Cycle pretend there are 2x as many CPU cores available in the cluster, thus increasing the number of shares that can be assigned.
See also: server overcommitting
Max CPU Usage for a Container Instance
The platform determines the maximum allowable CPU usage using several conditions based on the container's configuration and deployment strategy.
Cycle uses the following rules to calculate CPU max usage:
| Deployment Scenario | Core Count | Default CPU Usage Limit |
|---|---|---|
| Default Deployment Strategy | ≤ 2 cores | Max 10 shares (1 vCPU or thread) |
| Default Deployment Strategy | > 2 cores | Max 50% of available shares (half of available cores) |
| Deployment Scenario | Core Count | Default CPU Usage Limit |
|---|---|---|
| High Availability or Manual Strategy | ≤ 4 cores | Max 20 shares (2 Cores) |
| High Availability or Manual Strategy | > 4 cores | Max 50% of available shares (half of available cores) |
If the limit for CPU shares is set to 0, the instance has unlimited CPU usage.
RAM Resource Management
RAM resource management is straight forward when compared to CPU. RAM resource management supports limits and reserves as specified in kilobytes(kb), megabytes(MB), gigabytes(GB) and so on.
Manage Container Resources on Cycle
See our dedicated, usage-specific documentation for configuring container resources: