My AWS Database Migration Service (AWS DMS) migration task is slow. I want to improve the speed of an AWS DMS task that has large binary object (LOB) data.
Resolution
AWS DMS offers the following three large binary object (LOB) handling modes:
- Full LOB mode
- Limited LOB mode
- Inline LOB mode
Choose the right mode based on the actual size of the LOB data in your source tables, is the most effective way to improve task performance.
Full LOB mode
In Full LOB mode, AWS DMS migrates LOBs regardless of size. Because no maximum LOB size is defined, AWS DMS must look up and migrate each LOB individually. This can slow down your task significantly. The tradeoff is that AWS DMS never truncates the data, because it doesn't assume a maximum size up front.
To configure Full LOB mode, set FullLobMode to true and specify a LobChunkSize value in kilobytes (KB). The recommended LobChunkSize value is 64 KB. A value that's significantly higher than 64 KB can cause task failures.
To improve performance when you use Full LOB mode across multiple tables, take the following actions:
- Identify the size of the largest LOB in your source database.
- If the largest LOB is only a few megabytes (MBs) or less, then switch to Limited LOB mode instead for better performance.
- If some tables have LOBs larger than a few MB, then isolate those tables into a separate AWS DMS task that uses Full LOB mode. As a best practice, run this separate task on its own replication instance. This prevents the slower LOB processing from competing for resources with the rest of your migration.
Limited LOB mode
In Limited LOB mode, you specify a maximum LOB size up front. AWS DMS pre-allocates memory for LOB columns and applies them in bulk. This is significantly faster than the row-by-row lookups that Full LOB mode requires. If any LOB exceeds the size you specify, then AWS DMS truncates it and writes a warning to the AWS DMS task log.
To configure Limited LOB mode, set LimitedSizeLobMode to true and specify a LobMaxSize value in KB. The maximum value is 102,400 KB or 100 MB.
Complete the following steps before you run the task:
- Identify the maximum LOB size that exists in your source data. Don't rely on an assumed or worst-case estimate.
- Set LobMaxSize to match that maximum size. This gives you the performance benefit of Limited LOB mode without truncating legitimate data.
- Allocate sufficient memory to your replication instance. Limited LOB mode's performance gain depends on enough memory to buffer and batch-apply the LOB data.
To configure Inline LOB mode, complete the following steps:
- Set FullLobMode to true. Inline LOB mode is only available when Full LOB mode is active. The InlineLobMaxSize has no effect otherwise.
- Set InlineLobMaxSize to a value in KB with a range of 1 to 102,400 KB or 100 MB. The default value is 0 turns off inline transfer.
During the full load, AWS DMS checks each LOB's size. LOBs smaller than InlineLobMaxSize are transferred inline as part of the row data. LOBs larger than InlineLobMaxSize use standard Full LOB mode chunking.
Important: Set a value for InlineLobMaxSize only if most LOBs in your source data are smaller than that value. If most LOBs are large, then most rows still fall back to Full LOB mode handling. Inline LOB mode applies only during the full load phase. It has no effect on LOBs replicated during change data capture (CDC).
When you specify the task settings, you must set the InlineLobMaxSize parameter.
Example task settings JSON file:
{
"TargetMetadata": {
"TargetSchema": "abc",
"SupportLobs": true,
"FullLobMode": true,
"LobChunkSize": 64,
"LimitedSizeLobMode": false,
"LobMaxSize": 0,
"InlineLobMaxSize": 32,
"LoadMaxFileSize": 0,
"ParallelLoadThreads": 0,
"ParallelLoadBufferSize": 0,
"BatchApplyEnabled": false,
"TaskRecoveryTableEnabled": false,
"ParallelLoadQueuesPerThread": 0,
"ParallelApplyThreads": 0,
"ParallelApplyBufferSize": 0,
"ParallelApplyQueuesPerThread": 0
}
}
Related information
Migrating large binary objects (LOBs)
Target metadata task settings
Best practices for AWS Database Migration Service