Memory Limits

This documentation is for Dash Enterprise.
Dash Enterprise is the fastest way to write & deploy Dash apps and
Jupyter notebooks.
10% of the Fortune 500 uses Dash Enterprise to productionize AI and
data science apps. Find out if your company is using Dash Enterprise.

Resources on Dash Enterprise like user-created Dash apps and workspaces consume memory on the cluster nodes.

Strategies for reducing Dash app memory usage

Here are a few strategies that Dash app developers can consider to reduce their apps’ memory usage.
* Using the --preload flag in their app’s Procfile. For example:
web: gunicorn app:server --workers 4 --preload

Do not use the --preload flag if shared database connection pools are used (see Database Connections). For more information on preloading, refer to the Gunicorn docs.
* Reducing the amount of workers defined in their app’s Procfile.
* Using a file type for their datasets that supports memory mapping, like Arrow, and reading it with libraries like Vaex.
* Performing data queries and aggregations within the query on a database layer instead of in memory with Python.

When an app reaches its memory limit, Defining Variables for the Installation. When a workspace reaches its memory limit (usually because the development app is running), the development app is stopped and killed is printed in the workspace terminal.

The default memory limit that is defined in the Dash Enterprise Helm chart is 8192 MiB. This default applies to app processes, workspaces, and services.

This page can help you customize the maximum amount of memory that some or all of the resources on Dash Enterprise can consume.

Managing Memory Limits

To manage memory limits, you can:

Changing the Default Memory Limits

Prerequisites:

To change the default memory limits, use the helm upgrade command with --set flags.

The full command to change the default memory limits for all app processes looks like
sh helm upgrade $RELEASE_NAME \ --namespace $NAMESPACE \ --set agents.worker.app.defaultMemoryLimitMiB=<new-limit> \ --reset-then-reuse-values
where <new-limit> is the new default memory limit that you want to set in MiB. For example, 4096. Important: Your new default memory limit must be greater than or equal to 128 MiB, the memory that app processes request. No validation is performed when you edit the default memory limit. Contact us for help adjusting memory requests.

To change the default memory limit for all workspaces:
sh helm upgrade $RELEASE_NAME \ --namespace $NAMESPACE \ --set agents.worker.workspace.defaultMemoryLimitMiB=<new-limit> \ --reset-then-reuse-values
where <new-limit> is the new default memory limit that you want to set in MiB. For example, 4096. Important: Your new default memory limit must be greater than or equal to 128 MiB, the memory that workspaces request. No validation is performed when you edit the default memory limit. Contact us for help adjusting memory requests.

To change the default memory limit for all Redis and Postgres services:
sh helm upgrade $RELEASE_NAME \ --namespace $NAMESPACE \ --set agents.worker.service.redis.defaultMemoryLimitMiB=<new-limit-redis> \ --set agents.worker.service.postgresql.defaultMemoryLimitMiB=<new-limit-postgres> \ --reset-then-reuse-values
where <new-limit-redis> and <new-limit-postgres> are the new default memory limits that you want to set in MiB. For example, 4096. Important: Your new default memory limit must be greater than or equal to 128 MiB, the memory that services request. No validation is performed when you edit the default memory limit. Contact us for help adjusting memory requests.

The --reset-then-reuse-values flag applies all the other configurations that were set during the original installation.

The updated default memory limit is applied to new and existing resources that do not have a custom memory limit.

Setting a Custom Memory Limit for an App Process, Workspace, or Service

It’s good practice to set limits that are appropriate for each resource. If your organization has deployed apps with a variety of memory usage levels and the default memory limit is not appropriate for all of them, consider setting custom memory limits.

You can set custom memory limits for app processes, workspaces, and services to a maximum of 24,576 MiB, or 24 GiB.

If a process has multiple role, the custom memory limit applies to each replica. It is not shared between replicas.

When you save a custom memory limit, the resource is restarted. In the case of a service, both the service and the workspace (if one is attached) are restarted.

Prerequisites: