云端数据管理(Cloud data management)#
在云端管理数据时需要考虑两个方面:
🌐 There are two concerns when managing data on Cloud:
- 内存使用情况:处理大量数据的复杂工作流可能会超出 n8n 的内存限制。如果发生这种情况,实例可能会崩溃并无法访问。
- 数据存储:根据你的执行设置和数据量,你的 n8n 数据库可能会增大并耗尽存储空间。
为避免这些问题,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 millicore 可突发 CPU
- 入门版:320MiB 内存,10 millicore CPU 可突发
- Pro-1(1万次执行):640MiB 内存,可突发 20 millicore CPU
- Pro-2(50k 执行次数):1280MiB 内存,80 毫核 CPU 可突发
- 企业版:4096MiB 内存,80 毫核可突发 CPU
旧版计划:
🌐 Legacy plans:
- 起始:320MiB 内存,10 millicore 可突发 CPU
- 性能:1280MiB 内存,80 毫核 CPU 可突发
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 的 RAM。
🌐 Note that n8n itself consumes memory to run. On average, the software alone uses around 180MiB RAM.
与用户界面的交互也会消耗内存。在工作流界面执行大量操作时进行操作,也可能会使内存容量超过限制。
🌐 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:
- 在你的工作区或编辑器中,导航到 管理员面板。
- 选择 管理。
- 在 执行以保存 中取消选择你不想记录的执行。
工作流设置:
🌐 In your workflow settings:
- 选择选项
菜单。 - 选择 设置。n8n 会打开 工作流设置 模态窗口。
- 将 保存成功的生产执行 改为 不保存。
云端数据清理和内存溢出事件预防(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 天;
- 专业计划:最多保存 25000 次执行记录,执行日志保留 30 天;
- 企业计划:最多可保存 50,000 次执行记录,并且执行日志保留时间无限制。
手动数据修剪(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 发出警告。
- n8n 会清理执行数据。n8n 通过备份实例(工作流、用户、凭证和执行数据)并在恢复时不包括执行数据来实现这一点。
由于这个过程中涉及人工操作,警报系统并不完美。如果警告在非工作时间触发,或者数据消耗率过高,可能没有足够时间在剩余磁盘空间用完之前清理数据。
🌐 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.