473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Unusually High CPU on SQL Server the 2nd day after a reboot.

JL
To All,

I have a SQL2KSP3a database(<1GB) running on a 4x3GB physical CPU with
4GB of ram. It is Windows Server 2003 with hyper-threading turn on.
There are ~420 .Net users/cxns (fat client, no web/app servers) with
connection pooling and ~1 trx/sec. The database growth is neglegeable
and actually is not even relevent which I will explain in a minute.
99% of the trxs are from one SP that does a select. The resultsets are
relatively small as well 1~100 rows. Yes I have tuned it with index
tuning wizard as well, changed the SQL memory configurations, etc....

My problem is this...
The first day after a reboot, the server runs 6%CPU during peak hours.
During the non-peak hours until the next day something apparently
happens. The next day (2nd day after a reboot), it jumps to 40%CPU
during peak hours. The server will continue to run at 40%CPU during
peak hours until the next reboot. This phenomenon has been occurring
for 6 months or more and the traffic on the server is the same for day
1 as it is for day 2,3,4,... This database was on another server with
100+ dbs and exibited the same behavior, thus bringing that server to
its knees, and thus we had to move it to the server in question with no
other dbs.

I have googled my eyes out, Microsoft site, white papers, perfmon,
SQLDiag, PSSDiag, execution plans, index tuning wizard, and the list
goes on! I currently have a case open with Microsoft that has been
open for months now. I have been passed around to the 3rd "MS Tech
Specialist". I have ran PSSDiag a total of 6 times for them for hours
on end. I have changed MAXDOP. I could give more information, but I
would be here for days. I am running out of patience/ideas and
Microsoft is apparently blowing smoke.
Any ideas are greatly appreciated!
Thanks in advance!
JL

Jul 23 '05 #1
10 7272
>> The server will continue to run at 40%CPU during peak hours until
the next reboot

Taking a shot in the dark. Ensure the TempDB isn't running out of
space during operational hours. I believe TempDB is recreated each
time the MSSQL Service is restarted.

Jul 23 '05 #2
JL (jl*****@yahoo.com) writes:
My problem is this...
The first day after a reboot, the server runs 6%CPU during peak hours.
During the non-peak hours until the next day something apparently
happens. The next day (2nd day after a reboot), it jumps to 40%CPU
during peak hours. The server will continue to run at 40%CPU during
peak hours until the next reboot. This phenomenon has been occurring
for 6 months or more and the traffic on the server is the same for day
1 as it is for day 2,3,4,... This database was on another server with
100+ dbs and exibited the same behavior, thus bringing that server to
its knees, and thus we had to move it to the server in question with no
other dbs.

I have googled my eyes out, Microsoft site, white papers, perfmon,
SQLDiag, PSSDiag, execution plans, index tuning wizard, and the list
goes on!


Does that list include Profiler?

That is, the first thing I would to do if I was called in to look at
this, was to start Profiler, to see if there are any queries that runs
longer time than needed.

Ah, there is another thing to try in place of a reboot: run a DBCC
DROPCLEANBUFFERS. This flushes cache completely. If this lowers the
CPU usage just like a reboot does, then there is an issue with a cache.
Now, to further narrow it down, next time try DBCC FREEPROCCAHCE. This
only flushes the cache for query plans. If this helps too, I have a
strong suspicion. To wit, there is a problem if there are too many
similarly-looking queries being submitted, because the hashing in the
cache breaks down.

Then again, since you seem to use stored procedures, this is not likely
to be an issue - unless these procedures generates dynamic SQL?

By the way, are you using OPENXML somewhere?

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #3
Another hint is to monitor the number of database connections. Maybe it
keeps growing and after a few days starts swamping the system.

HTH,
Gert-Jan
JL wrote:

To All,

I have a SQL2KSP3a database(<1GB) running on a 4x3GB physical CPU with
4GB of ram. It is Windows Server 2003 with hyper-threading turn on.
There are ~420 .Net users/cxns (fat client, no web/app servers) with
connection pooling and ~1 trx/sec. The database growth is neglegeable
and actually is not even relevent which I will explain in a minute.
99% of the trxs are from one SP that does a select. The resultsets are
relatively small as well 1~100 rows. Yes I have tuned it with index
tuning wizard as well, changed the SQL memory configurations, etc....

My problem is this...
The first day after a reboot, the server runs 6%CPU during peak hours.
During the non-peak hours until the next day something apparently
happens. The next day (2nd day after a reboot), it jumps to 40%CPU
during peak hours. The server will continue to run at 40%CPU during
peak hours until the next reboot. This phenomenon has been occurring
for 6 months or more and the traffic on the server is the same for day
1 as it is for day 2,3,4,... This database was on another server with
100+ dbs and exibited the same behavior, thus bringing that server to
its knees, and thus we had to move it to the server in question with no
other dbs.

I have googled my eyes out, Microsoft site, white papers, perfmon,
SQLDiag, PSSDiag, execution plans, index tuning wizard, and the list
goes on! I currently have a case open with Microsoft that has been
open for months now. I have been passed around to the 3rd "MS Tech
Specialist". I have ran PSSDiag a total of 6 times for them for hours
on end. I have changed MAXDOP. I could give more information, but I
would be here for days. I am running out of patience/ideas and
Microsoft is apparently blowing smoke.
Any ideas are greatly appreciated!
Thanks in advance!
JL

Jul 23 '05 #4
JL
Tempdb is not running out of space. I have actually set tempdb to 1GB
with 10% auto-grow. No OpenXML. The connections correlate to the number
of users logged in at any given time. The DROPCLEANBUFFERS &
FREEPROCCAHCE was the first thing that Microsoft had me do. No luck.
I have used profiler many times with this. I have even done a spid to
thread correlation with not luck in finding any rogue processes.
Microsoft has run the "Read 80" tool also; it apparently creates an
aggregate report on the PSSDiag output.

Another piece to the puzzle is that I have just applied some indexes
recommended by the index tuning wizard. I did some testing and found
that indeed the indexes did help, but I have been holding off applying
them to production as to not disturb my baseline. My thinking is that
even if the indexes did help, it would not explain the problem at hand.
Since I have applied the indexes, the CPU is now running at 12%
consistently. It hasn't been rebooted since then, but SQL Server has
been restarted. It doesn't appear that the new indexes have fixed the
problem because theoretically with the indexes applied, it should run
below the 6%.

(Sorry if I sounded like I was MS bashing. They have been relatively
good with responses. I am just at my wits end.)
Thanks for the replies!
JL

Jul 23 '05 #5
JL (jl*****@yahoo.com) writes:
(Sorry if I sounded like I was MS bashing. They have been relatively
good with responses. I am just at my wits end.)
Thanks for the replies!


Admittedly, it is likely that you get better and more precise answers
from MS support staff from people in the newsgroup. After all, they
have more information about the case than we have. And they even get
paid to consider the situation!

All we can offer are shots in the dark.

Good news to hear that the indexes appear to help.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #6
> My problem is this...
The first day after a reboot, the server runs 6%CPU during peak hours. During the non-peak hours until the next day something apparently
happens. The next day (2nd day after a reboot), it jumps to 40%CPU
during peak hours. The server will continue to run at 40%CPU during
peak hours until the next reboot.


JL,

The company I work for has experienced the exact same problem. We
haven't figured out *exactly* what's happening, but we have a pretty
good idea that this CPU usage jump is caused by the use of prepared
statements in our application.

We have a Java/J2EE app which uses a mixture of stored procedures and
prepared statements to access the database. What we noticed (after
several months of beating our heads against a wall) is that the
increase in CPU overall usage was *entirely* due to an increase in the
CPU cost of prepared statements. In fact, we could detect this
"failure" by noticing when the average CPU cost of a prepared statement
jumped up above 15ms for our app.

We measure this by running a trace and then extracting summary
information on prepared statements (e.g., "... textdata LIKE 'exec
sp_execute%'") vs everything else in the mix. Unmodified, our db
performance lasted 54 hours before degenerating. However, we modified
our application to replace some of the most commonly issued prepared
statements with stored procedures and this has effectively cured the
problem.

The actual root cause is still a mystery. While running around in the
app code, we noticed some bad practice where unique prepared statements
would be generated thousands of times, differing only by some small
string which really should have been a parameter in the first place.
Maybe we blew out SQL Server's buffer for holding on to these things.

My advice is to run a trace and take a look at your prepared statement
CPU cost.

Jul 23 '05 #7
(an******@gmail.com) writes:
The actual root cause is still a mystery. While running around in the
app code, we noticed some bad practice where unique prepared statements
would be generated thousands of times, differing only by some small
string which really should have been a parameter in the first place.
Maybe we blew out SQL Server's buffer for holding on to these things.


Yes, this is an issue that have been observerd by others, and there's
even a hotfix, as described in http://support.microsoft.com/?scid=884850.
Although, I believe the discussion went something like this mainly happens
when you have lots of memory. The more memory you have, the bigger the
procedure cache can get, and the more similarly-looking queries can fit
there, increasing the time it takes to find if a query alread is in
cache or not.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #8
JL

Erland Sommarskog wrote:
(an******@gmail.com) writes:
The actual root cause is still a mystery. While running around in the app code, we noticed some bad practice where unique prepared statements would be generated thousands of times, differing only by some small
string which really should have been a parameter in the first place. Maybe we blew out SQL Server's buffer for holding on to these
things.
Yes, this is an issue that have been observerd by others, and there's
even a hotfix, as described in http://support.microsoft.com/?scid=884850. Although, I believe the discussion went something like this mainly happens when you have lots of memory. The more memory you have, the bigger the procedure cache can get, and the more similarly-looking queries can fit there, increasing the time it takes to find if a query alread is in
cache or not.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp


Thanks for the info guys! All of the SQL is in stored procedures, but
it does look promising.

BTW - I have sent the database to Microsoft for them to look at. I
noticed that the hotfix was posted on 2/4/2005... How convenient!

Thanks Again!
JL

Jul 23 '05 #9
JL (jl*****@yahoo.com) writes:
Thanks for the info guys! All of the SQL is in stored procedures, but
it does look promising.

BTW - I have sent the database to Microsoft for them to look at. I
noticed that the hotfix was posted on 2/4/2005... How convenient!


Hm, I don't think the KB article applies to your case. I reviewed the
thread on Google, and I hinted at this problem then as well, but you
told me that FREEPROCCACHE and DROPCLEANBUFFERS had no effect. (But
FREEPROCCACHE is something Andy could try.)
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 23 '05 #10
I have experienced a similar problem for months and finally have a
solution.

If you have non-unicode varchar columns in your database, and you use
prepared statements, and you are querying against indexes on these
columns, your queries are probably not using the indexes. By default
the jdbc driver passes string parameters as unicode, and the unicode
paramaters do not use non-unicode indexes.

Try adding the following to your connection string

SendStringParametersAsUnicode=false

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ben Allen | last post by:
Is there a way (through a variable) to show the date of the last server reboot i.e. when PHP last started running? As I am trying to show the server uptime, which of course only works from the last...
2
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
19
by: Thue Tuxen Sørensen | last post by:
Hi everybody ! I´m maintaining a large intranet (approx 10000 concurrent users) running on one IIS box and one DB box with sqlserver 2000. Currently there is 2,5 GB Ram, 1 1400 mhz cpu and 2...
3
by: Guillaume Senneville | last post by:
hi, we are having this weird problem that can be reproduced easily on 2 out of 2 servers where we've tried: - we run a SQL Server 2000 stored procedure that processes 2.5 million rows (big...
2
by: Tim Nelson | last post by:
I created a simple C# .Net application to prove I can deploy it on a Win2k server running terminal services. I installed the 1.1 .Net Framework and installed the application (using a VS Setup app)...
1
by: Keith | last post by:
All, I have been told this is an ASP.NET issue and not an IIS issue, so I am posting this here. I have a problem with ASP.NET returning an HTTP 500 error when trying to run ASPX pages on...
0
by: jsausten | last post by:
I am having this ridiculously frustrating problem, migrating an existing web app to VS.2005. Initially I was able to successfully convert my VS 2002 app, by opening the Localhost site using the...
5
by: war_wheelan | last post by:
I created the db with the attached script and I am able to access it until I reboot the server. I've tried enabling flag 1807 via the SQL server service and the startup parameters of the instance....
3
by: Steve | last post by:
Hi All I downloaded Sql server 2005 express SP2 and attempted to modify the Bootstrapper package files as I did with SP1 When i try to install SQL server as part of my VS 2005 deployment app I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.