Team City has slow builds possibly caused by heavy SQL Server usage

I have a similar question to this: https://teamcity-support.jetbrains.com/hc/en-us/community/posts/115000571390-TeamCity-heartbeat-putting-load-on-sql-server?input_string=Team%20City%20has%20slow%20builds%20possibly%20caused%20by%20heavy%20SQL%20Server%20usage

We seem to have builds whose duration varies significantly between 18 minutes and 30 minutes. When the build is slow, the only obvious thing that is running heavy on the TeamCity server is the database, taking up an entire core and possibly then pegged, which might well slow everything else down. When I run the SQL profiler, it doesn't seem like lots of important traffic, more like thousands of progress type calls, some of which don't even look like complete statements.

I guess my questions are:

  • How I can debug this high cpu usage for SQL Server?
  • Is there any way I can run something to check/clean up the database?
  • Since we have upgraded many times, is it possible the database is messed up and can it be reset?

Thanks

0
1 comment
Hello Luke,
First I would recommend you to check the build logs to see if there are any long operations or if the slowness is spread across the entire build. It might also help to track the problem if you analyze the build duration evolution over time to see which particular events might have slowed the builds. If the slowness is spread across most of the operations, I would advise to check the agent machine resources (CPU, disk, memory, network) during a build to identify any possible bottleneck and which processes are causing it.
 
Regarding possible database issues, first I would like to ask you if you are using the embedded database or if it is in a separate SQL server. If you are using the embedded database, we recommend you to migrate to a dedicated one as soon as possible: 
If you are using a separate SQL server and you want to check the database, I can only recommend using specific tools for that effect (SQL Management Studio activity monitor or SQL Store, or in case you are using Azure Azure Data studio).
 
In TeamCity documentation there is a clean-up guide that might assist to clean some obsolete data:
Let me know if you have any more doubts.
 
Thanks
0

Please sign in to leave a comment.