Overview

CPU and memory resources on Cerebrium are allocated per container and billed based on actual usage. Each app can be configured with specific CPU and memory requirements to optimize performance and cost.

Resource Configuration

CPU Configuration

CPU resources are specified as vCPU units (float) in the cerebrium.toml file:

[cerebrium.hardware]
cpu = 4    # Number of vCPU cores

For most applications, starting with 4 CPU cores is recommended. Additional cores can be added based on monitoring and performance requirements. CPU usage is throttled when exceeding the specified limit. It is also possible to request a fractional CPU (e.g 0.5).

Memory Configuration

Memory is specified in gigabytes as a floating point number:

[cerebrium.hardware]
memory = 16.0    # Memory in GB

A general guideline is to allocate system memory equal to the GPU’s VRAM capacity. This accounts for initial model loading and compilation before GPU transfer. Applications will terminate with an Out of Memory (OOM) error if they exceed the specified memory limit.

Memory and CPU is billed based on usage, which reduces costs for end-users and doesn’t require the overprovisioning of an entire instance.

Resource Limits

Resource limits depend on the selected hardware configuration:

Hardware TypeMax CPU CoresMax Memory (GB)
CPU Only4896
ADA_L4016128
AMPERE_A10012140
AMPERE_A1048192
ADA_L448192
TURING_T448192
HOPPER_H10024256
TRN1128512
INF2192796

Memory Optimization

The transformers library provides memory optimization through the low_cpu_mem_usage flag, which reduces memory footprint at the cost of longer initialization times. Implementing lazy loading for large datasets can further optimize memory usage. Regular monitoring of memory patterns through platform metrics helps identify optimization opportunities. Memory-efficient model loading techniques should be considered for large-scale deployments.

Resource Monitoring

The platform monitors CPU utilization and throttling events to help identify performance bottlenecks. Memory usage and OOM events are tracked to prevent application failures.

Support

The Cerebrium team encounters projects of all shapes and sizes and are confident to support teams through the optimisation of app resources and architecture for cost and performance. Join our Discord community or reach out to support@cerebrium.ai with any questions.