When your Azure Data Factory (ADF) pipeline is running longer than expected and fails with Error Code 2011: Execution Timeout Expired
, it typically indicates that a SQL command (within a Script Activity) has exceeded the default command timeout, or the target Azure SQL Database is under performance pressure, causing slower execution.
Follow the below mentioned resolution steps:
-- Consider scaling up the Azure SQL Database temporarily during pipeline execution:
This will avoid timeout issues caused by throttling.
-- Monitor Performance and Resource Usage:
Use Query Performance Insight in Azure SQL to identify long-running queries, Query duration trends and DTU/CPU bottlenecks.
Under Query Performance Insight Find the query running from ADF and analyze duration, DTU usage.
-- Optimize Your SQL Script:
If the SQL script includes heavy operations like MERGE, large UPDATE, DELETE, or table scans, ensure indexes are in place on join/filter columns. Also break down large operations into smaller chunks. You can also use batching with loops or temp tables to avoid timeouts.
-- Increase Script Activity Timeout in ADF:
In ADF Studio, Select the Script Activity in the pipeline. Then In the Settings tab, scroll to Command timeout and set the timeout to a higher value.
-- Ensure Stable SHIR Connectivity (for On-Prem Source):
If your source is on-prem (nonprime) and connected via Self-hosted IR, ensure the SHIR host has a stable and high-bandwidth connection to Azure SQL DB. Poor connectivity can also result in long runtimes or intermittent failures.