cpu usage spikes high when an active process runs for a long time.

Heisenberg 261 Reputation points
2021-09-08T18:09:57.377+00:00

If a sql server session running for long time (active) state. can it cause a CPU spike. There is a process in our database that reads transactions from the transaction log using fn_dblog and transfer those changes to mysql database tables. Sometimes process runs for long time 2-3 hours and at that time CPU utilization hits very high. so may question is if a active process runs for a long time can it cause cpu spike as compared to one running for 5-10 mins. Another point to note that we are using resource governor so that any sessions from this particular user should not be using more than 20% cpu.

SQL Server | Other
{count} votes

1 answer

Sort by: Most helpful
  1. AmeliaGu-MSFT 14,006 Reputation points Microsoft External Staff
    2021-09-09T05:26:00.563+00:00

    Hi SQLServerBro,

    Could you please check if there is blocking and check waits? Long-running queries may be waiting for resources or operations to complete.
    You can use the Activity Monitor to check the blocking and waits when the process is active.
    Please refer to this article about capturing the queries causing high CPU which might be helpful.

    Best Regards,
    Amelia


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

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.