云端数据管理#
¥Cloud data management
在云端管理数据时需要考虑两个方面:
¥There are two concerns when managing data on Cloud:
- 内存使用情况:处理大量数据的复杂工作流可能会超出 n8n 的内存限制。如果发生这种情况,实例可能会崩溃并变得无法访问。
¥Memory usage: complex workflows processing large amounts of data can exceed n8n's memory limits. If this happens, the instance can crash and become inaccessible.
- 数据存储:根据你的执行设置和卷,你的 n8n 数据库可能会增长并耗尽存储空间。
¥Data storage: depending on your execution settings and volume, your n8n database can grow in size and run out of storage.
为避免这些问题,n8n 建议你在构建工作流时考虑内存效率,并且不要保存不必要的数据。
¥To avoid these issues, n8n recommends that you build your workflows with memory efficiency in mind, and don't save unnecessary data
各云计划的内存限制#
¥Memory limits on each Cloud plan
当前计划:
¥Current plans:
- 试用:320MiB 内存,10 微核 CPU(突发模式)
¥Trial: 320MiB RAM, 10 millicore CPU burstable
- 启动:320MiB 内存,10 微核 CPU(突发模式)
¥Starter: 320MiB RAM, 10 millicore CPU burstable
- 专业版 1(1 万次执行):640MiB 内存,20 微核 CPU(突发模式)
¥Pro-1 (10k executions): 640MiB RAM, 20 millicore CPU burstable
- 专业版 2(5 万次执行):1280MiB 内存,80 微核 CPU(突发模式)
¥Pro-2 (50k executions): 1280MiB RAM, 80 millicore CPU burstable
- 企业:4096MiB 内存,80 微核 CPU(突发模式)
¥Enterprise: 4096MiB RAM, 80 millicore CPU burstable
旧版计划:
¥Legacy plans:
- 开始:320MiB 内存,10 微核 CPU(突发模式)
¥Start: 320MiB RAM, 10 millicore CPU burstable
- 权限:1280MiB 内存,80 微核 CPU(突发模式)
¥Power: 1280MiB RAM, 80 millicore CPU burstable
n8n 为每个实例提供高达 100GB 的数据存储空间。
¥n8n gives each instance up to 100GB of data storage.
如何降低工作流的内存消耗#
¥How to reduce memory consumption in your workflow
构建工作流的方式会影响其执行时消耗的数据量。虽然这些指南并非适用于所有情况,但它们提供了避免实例内存超限的最佳实践基准。
¥The way you build workflows affects how much data they consume when executed. Although these guidelines aren't applicable to all cases, they provide a baseline of best practices to avoid exceeding instance memory.
- Split the data processed into smaller chunks. For example, instead of fetching 10,000 rows with each execution, process 200 rows with each execution.
- Avoid using the Code node where possible.
- Avoid manual executions when processing larger amounts of data.
- Split the workflow up into sub-workflows and ensure each sub-workflow returns a limited amount of data to its parent workflow.
Splitting the workflow might seem counter-intuitive at first as it usually requires adding at least two more nodes: the Loop Over Items node to split up the items into smaller batches and the Execute Workflow node to start the sub-workflow.
However, as long as your sub-workflow does the heavy lifting for each batch and then returns only a small result set to the main workflow, this reduces memory consumption. This is because the sub-workflow only holds the data for the current batch in memory, after which the memory is free again.
请注意,n8n 本身运行会消耗内存。平均而言,该软件本身会占用约 180MiB 内存。
¥Note that n8n itself consumes memory to run. On average, the software alone uses around 180MiB RAM.
与 UI 的交互也会消耗内存。在工作流执行大量任务时操作 UI 可能会导致内存容量超出限制。
¥Interactions with the UI also consume memory. Playing around with the workflow UI while it performs heavy executions could also push the memory capacity over the limit.
如何管理云端执行数据#
¥How to manage execution data on Cloud
执行数据包括节点数据、参数、变量、执行上下文和二进制数据引用。基于文本。
¥Execution data includes node data, parameters, variables, execution context, and binary data references. It's text-based.
二进制数据是指 n8n 无法表示为纯文本的非文本数据。这指的是图片、文档、音频文件和视频等文件和媒体。比文本数据大得多。
¥Binary data is non-textual data that n8n can't represent as plain text. This is files and media such as images, documents, audio files, and videos. It's much larger than textual data.
如果工作流消耗大量数据且已过测试阶段,建议停止保存成功执行的记录。
¥If a workflow consumes a large amounts of data and is past testing stage, it's a good option to stop saving the successful executions.
你可以通过两种方式控制 n8n 在数据库中存储的执行数据量:
¥There are two ways you can control how much execution data n8n stores in the database:
管理控制面板:
¥In the admin dashboard:
- 在工作区或编辑器中,导航至管理面板。
¥From your workspace or editor, navigate to Admin Panel. 2. 选择“管理”。
¥Select Manage. 3. 在“要保存的执行”中,取消选择你不想记录的执行。
¥In Executions to Save deselect the executions you don't want to log.
工作流设置:
¥In your workflow settings:
- 选择“选项”菜单。
¥Select the Options {.off-glb} menu. 2. 选择“设置”。n8n 打开“工作流设置”模态框。
¥Select Settings. n8n opens the Workflow settings modal. 3. 将“保存成功生产执行”更改为“不保存”。
¥Change Save successful production executions to Do not save.
云端数据清理和内存溢出事件预防#
¥Cloud data pruning and out of memory incident prevention
自动数据修剪#
¥Automatic data pruning
n8n 会在一定时间后或达到最大存储限制后自动清理执行日志,以先到者为准。数据修剪始终从最旧到最新进行,限制取决于你的云计划:
¥n8n automatically prunes execution logs after a certain time or once you reach the max storage limit, whichever comes first. The pruning always happens from oldest to newest and the limits depend on your Could plan:
- 开始和启动计划:最多保存 2500 次执行,执行日志保留 7 天;
¥Start and Starter plans: max 2500 executions saved and 7 days execution log retention;
- 专业版计划:最多保存 25000 次执行,执行日志保留 30 天;
¥Pro plans: max 25000 executions saved and 30 days execution log retention;
- 企业计划:最多保存 50000 次执行记录,执行日志保留时间无限制。
¥Enterprise plan: max 50000 executions saved and unlimited execution log retention time.
手动数据修剪#
¥Manual data pruning
尽管有自动清理机制,但更繁重的执行和用例仍可能超出数据库容量。在这种情况下,n8n 将手动清理数据以保护实例稳定性。
¥Heavier executions and use cases can exceed database capacity despite the automatic pruning practices. In cases like this, n8n will manually prune data to protect instance stability.
- 如果实例磁盘容量达到 85%,警报系统会向 n8n 发出警告。
¥An alert system warns n8n if an instance is at 85% disk capacity. 2. n8n 清理执行数据。n8n 通过运行实例(工作流、用户、凭据和执行数据)的备份,并在不包含执行数据的情况下恢复实例来实现这一点。
¥n8n prunes execution data. n8n does this by running a backup of the instance (workflows, users, credentials and execution data) and restoring it without execution data.
由于此过程中存在人为操作步骤,因此警报系统并不完美。如果在非工作时间触发警告,或者数据消耗率很高,则可能没有时间在剩余磁盘空间被填满之前清理数据。
¥Due to the human steps in this process, the alert system isn't perfect. If warnings are triggered after hours or if data consumption rates are high, there might not be time to prune the data before the remaining disk space fills up.