Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

DB server CPU 100%

Posted on 2011-02-10
4
Medium Priority
?
669 Views
Last Modified: 2012-05-11
Experts -

The DB server CPU usage hitting 100% sometimes. I do see the some SQL running little longer at these times which runs quicker all the other time. But whenever we reset the WEB server the DB CPU also going down to 20% and stays at 20 for 4-5 hours.

Any idea where to look for the solution?

This is .net /SQL server app.

Thanks,

~sve
0
Comment
Question by:sventhan
4 Comments
 
LVL 28

Accepted Solution

by:
strickdd earned 800 total points
ID: 34864665
It sounds like there is a looping/unclosed connection in your code. I would verify that all loops have the connection objects specified and opened OUTSIDE the loop. Then make sure that all your connections have the .Close() method called. Sometimes you may be looping and calling a function that makes a connection so it might not be obvious so track down all the loops and scan all the functions the loops call.

If you don't find any of these then i would take a look at the queries being executed. It could be a deadlock being caused by an overly complex query. Lastly, I would check database triggers and make sure that they are set up properly and not causing issues.
0
 
LVL 40

Assisted Solution

by:lcohan
lcohan earned 800 total points
ID: 34864862
You should also chek your SQL log file for any entries that can lead to the CPU spike. BTW after a web server restart your object/data cache in SQL is also refreshed and maybe you need to look closer at your DB stats/missing indexes and bad query plans stuck in cache.
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 400 total points
ID: 34867979
Unfortunately, it sounds like you are sharing the same server for both web server and SQL Server.  This is no recommended, but if you have to do it, you will have to cripple SQL Server by setting the max memory it uses.
0
 
LVL 18

Author Closing Comment

by:sventhan
ID: 34887052
Thanks to you all. The problem is with some SQL (poorly written) update statements. This is getting executed more than wanted. I'm looking into this now.


@acperkins

We have 2 different servers.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question