Lag time for Executing the sql Procs

v-aninam 1 Reputation point
2022-02-22T23:27:35.81+00:00

Hi Experts,

I had one concern and need you guys to help here

Env: VS,sql,SSIS,SSRS,SSAS 2014

The caller is SSIS and calls is a stored procedure that loops in Database and calls the different dependent Child Stored procedures like 200 of them(everything is sequential to follow the dependencies).like mentioned.. there 4 to 5 processes (threaded jobs) will run in parallel. Now the question, I am seeing so much lag time to call the store procedures
Example: 1 stored proc will execute in 30 sec.. to start itself it takes 3 min and then completes in 30 sec. So for each child stored procedure, it waits 30 sec to 3 min to kick start the execution. So total 200 Stored procedures avg execution time is 6 min to 10 min... but because of lag time.. its takes 20 to 25 min of time.

  1. I have identified the cached plan are wiping out and recreating because of AUTO_CREATE_STATISTICS/ AUTO_UPDATE_STATISTICS .->is this the cause for the lagtime?
  2. Memory pressure is almost 65 to 70% and we have 300 GB of RAM assigned to sqlserver
  3. No Significant wait starts observed for memory /CPU Bottle necks
  4. we have the best Disks similar to SSD.

why i am seeing significant lag times.. and how to reduce the same. Please redirect me to right path.

Thanks
v-aninam

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,778 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,576 questions
{count} votes

6 answers

Sort by: Most helpful
  1. Olaf Helper 44,501 Reputation points
    2022-02-23T06:45:57.547+00:00

    why i am seeing significant lag times

    We don't know your database design nor what the stored procedures do, so we can not guess the cause.

    What about blocking; if all SP accesses the same resources/tables, they can block each other and that would cause the "lag time"?

    0 comments No comments

  2. Tom Phillips 17,731 Reputation points
    2022-02-23T15:14:50.367+00:00

    Most likely you are seeing the limits of parallelism in SSIS, not a problem with the proc compile time.

    SSIS as a default only runs CPUs/2 parallel processes. If you have more parallel processes, it does not start a new task.

    See:
    https://www.mssqltips.com/sqlservertip/6078/parallel-execution-of-tasks-in-ssis/

    0 comments No comments

  3. Erland Sommarskog 111.1K Reputation points MVP
    2022-02-23T22:53:53.833+00:00

    It is very difficult to diagnose problems only from a verbal description. It's even clear to me what the lag time is. Are you saying that it takes three minutes before the procedure actually starts running? How did you conclude that?

    There can indeed be a startup time if the plan for the procedure is not in the cache and has to be compiled. But three minutes, that's quite excessive, unless this is a monster procedure. Then again, you need some skill to actually record this delay, so I am not sure that this is what you are seeing.


  4. v-aninam 1 Reputation point
    2022-02-24T23:22:52.353+00:00

    Experts,
    Any update on this Question.. we are still bleeding ..

    please redirect me to right direction.

    thanks

    0 comments No comments

  5. Erland Sommarskog 111.1K Reputation points MVP
    2022-02-25T22:34:29.447+00:00

    I would suggest that you do this with a few of the procedures:

    1. Rename the existing procedure.
    2. Write a new procedure reusing the old name. All this procedure does is to: a) Log to audit table. b) Call the old procedure. c) Write to audit table.

    If you see lag between the wrapper and the inner procedure, this is a strong indication that compilation is the culprit. But as I said, I find it unlikely that compilation takes three minutes.

    Also, autostats will not wipe out the cache. It can trigger recompilation, but this occurs on statement level, so it is not the entire procedure that is recompiled. So if plans are being wiped out of the cache entirely, it is for some other reason.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.