Unexplained CPU and Disk activity spikes in SQL Server 2005

Posted by Philip Goh on Server Fault See other posts from Server Fault or by Philip Goh
Published on 2011-10-26T20:04:03Z Indexed on 2011/11/20 1:56 UTC
Read the original article Hit count: 667

Filed under:
|
|
|

Performance Monitor of Database Server

Before I pose my question, please allow me to describe the situation. I have a database server, with a number of tables. Two of the biggest tables contain over 800k rows each. The majority of rows are less than 10k in size, though roughly 1 in 100 rows will be > 1 MB but <4 MB. So out of the 1.6 million rows, about 16000 of them will be these large rows. The reason they are this big is because we're storing zip files binary blobs in the database, but I'm digressing.

We have a service that runs constantly in the background, trimming 10 rows from each of these 2 tables. In the performance monitor graph above, these are the little bumps (red for CPU, green for disk queue). Once ever minute we get a large spike of CPU activity together with a jump in disk activity, indicated by the red arrow in the screenshot.

I've run the SQL Server profiler, and there is nothing that jumps out as a candidate that would explain this spike. My suspicion is that this spike occurs when one of the large rows gets deleted. I've fed the results of the profiler into the tuning wizard, and I get no optimisation recommendations (i.e. I assume this means my database is indexed correctly for my current workload).

I'm not overly worried as the server is coping fine in all circumstances, even under peak load. However, I would like to know if there is anything else I can do to find out what is causing this spike?

Update:

After investigating this some more, the CPU and disk usage spike was down to SQL server's automatic checkpoint. The database uses the simple recovery model, and this truncates the log file at each checkpoint. We can see this demonstrated in the following graph. Checkpoints/sec and percent of log used As described on MSDN, the checkpoints will occur when the transaction log becomes 70% full and we are using the simple recovery model.

This has been enlightening and I've definitely learned something!

© Server Fault or respective owner

Related posts about sql

Related posts about sql-server