Skip to content

How do I resolve the "replication task out of memory" error in AWS DMS?

3 minute read
0

My AWS Database Migration Service (AWS DMS) replication task fails with the "Last Error Replication task out of memory. Stop Reason FATAL_ERROR Error Level FATAL" error.

Short description

An AWS DMS replication task runs out of memory when task settings consume more memory than the replication instance provides. To resolve the error, reduce memory-intensive task settings, increase the replication instance size, or redistribute tasks across multiple instances.

Resolution

Identify the cause

Check the AWS DMS task logs and Amazon CloudWatch memory metrics. Check the FreeMemory and SwapUsage metrics to determine whether the instance is running low on available memory.

To resolve this error, complete the resolution that best fits your use case.

Change the task settings or memory-related parameters

Note: You must stop your task before you make modifications. After you save the changes, resume the task. If the task stops during the full load phase, then the affected tables reload from the start.

Check whether you can reduce the following task settings or memory-related parameters that consume higher memory:

  • Large binary object (LOB) settings
  • Validation parameters, such as ThreadCount and PartitionSize
  • Parallel thread parameters, such as ParallelLoadThreads, ParallelLoadBufferSize, ParallelLoadQueuesPerThread, ParallelApplyThreads, ParallelApplyBufferSize, and ParallelApplyQueuesPerThread
  • Batch apply parameters, such as BatchApplyTimeoutMin, BatchApplyTimeoutMax, BatchApplyMemoryLimit, and BatchSplitSize
  • Other memory-related task settings, such as MinTransactionSize, MemoryLimitTotal, MemoryKeepTime, and StatementCacheSize

For more details on the preceding task settings and parameters, see How do I optimize AWS DMS memory usage for migration?

Increase your replication instance class size

If CloudWatch metrics show that FreeMemory decreases over time or SwapUsage increases, then the current instance doesn't have enough memory for the workload. Upgrade to a larger replication instance. You can also use memory-optimized instances for memory-intensive workloads, such as ongoing migrations and replications of high-throughput transactions.

Adjust task count and parallelism on the replication instance

If the replication instance still runs out of memory after you reduce task settings, then adjust how tasks are distributed.

If the replication instance has multiple tasks, then use the MemoryUsage metric to view the amount of memory that the task consumes. To determine why the task holds memory in the change data capture (CDC) phase, compare CDCChangesMemorySource and CDCChangesMemoryTarget. Troubleshoot the respective endpoint.

When multiple tasks run on the replication instance, take one or more of the following actions:

  • Reduce the number and type of tasks that run on the replication instance.
  • Move the failed task to a different replication instance, and then try again.
  • Increase instance capacity.

For tasks that load multiple tables in parallel or that migrate many tables and schemas, take one or more of the following actions:

  • Reduce the number of tables that you load in parallel.
  • Reduce the number of total tables and schemas that you migrate.
  • Use a different task on a different replication instance to offload the migration of some of the tables and schemas.
  • Increase instance capacity.

Related information

Target metadata task settings

Change processing tuning settings

AWS Database Migration Service metrics