I have an Azure Data Factory that uses a self-hosted integration runtime to import and update data in Azure SQL Managed Instance. The SHIR and MI are on the same VNet. The SHIR is on a VM with 8vcores and 16 GB RAM. The ADF is using the Managed VNet offering for the Azure IR (not sure that is relevant since I'm using SHIR, but noting for completeness).
I have a parent pipeline with a for each loop that calls a child pipeline. In my child pipeline, I have the following: lookup -> copy activity -> stored proc. The sink on the copy activity is the same MI but different DB from the stored proc. But I'm consistently seeing long queue times on the stored proc. The stored proc itself is very simple.
I can see that this stored proc activity frequently takes 43 seconds and 40 of that is queueing. This proc runs about 250 times every 30 minutes. I have monitored the SHIR, and while CPU does occasionally max out at the very beginning of a run, it is not at maximum capacity while this stored proc activity is occurring (CPU gets high at the very beginning of the process and then drops down). There's plenty of memory, so I know that isn't an issue. Usually when I check monitoring while the activity is executing, it shows 5 - 10% CPU, > 10 GB available memory, plenty of job slots available.
The only relevant advice I see for tuning an SHIR is to make sure it has enough CPU and memory and that there are concurrent job workers available. And there are. All other advice I have found is related to copy activities or data flows.
What can I do to troubleshoot the long queue times before the stored proc activity?