Hi All,
I have a question about CPU usage. Actually, I believe that SQL server
isn't using as much as it could!
I have dual Xeon machine (shows up as 4 CPUs to SQL server due to
HyperThreading)
No matter what queries I run, the CPU usage never goes above 25%. In
the Enterprise Mangager, it's set to use CPUs 0 through 3, so I know
that's not the issue. The number of processors is the same since I
installed SQL server.
I'm pretty sure that SQL Server is confused about something, as running
updates on a million rows or doing selects on calculated fields never
pushes it above 25%. I'm thinking SQL server for some reason thinks
there's only one CPU. The odd thing in the Windows Task Manager is that
it shows activity (low amounts) on each CPU.
Am I not understanding something, or is this a real problem?If your COU is not going beyond 25% then you should be happy about it :-)
But you aren't. So, is something running slow? What makes you worry about
your CPU utilization?
--
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
"Chris Kuske" <chris@.solidoak.com> wrote in message
news:4138a5f6$1@.newsfeed.netlojix.com...
> Hi All,
> I have a question about CPU usage. Actually, I believe that SQL server
> isn't using as much as it could!
> I have dual Xeon machine (shows up as 4 CPUs to SQL server due to
> HyperThreading)
> No matter what queries I run, the CPU usage never goes above 25%. In
> the Enterprise Mangager, it's set to use CPUs 0 through 3, so I know
> that's not the issue. The number of processors is the same since I
> installed SQL server.
> I'm pretty sure that SQL Server is confused about something, as running
> updates on a million rows or doing selects on calculated fields never
> pushes it above 25%. I'm thinking SQL server for some reason thinks
> there's only one CPU. The odd thing in the Windows Task Manager is that
> it shows activity (low amounts) on each CPU.
> Am I not understanding something, or is this a real problem?|||You really should use Perfmon to monitor activity and not task manager but
as Vyas stated this may be fine. It really depends on what your doing and
how. Inserts / Updates and Deletes are always single threaded operations
for the actual data mod part. They may use parallelism for the WHERE clause
but it does depend. Another possibility is that you have bottlenecks else
where. Have you looked at the memory and disk counters in perfmon? If you
have a high disk queue your procs may be waiting on them and thus are not
able to do as much work as you think they should.
--
Andrew J. Kelly SQL MVP
"Chris Kuske" <chris@.solidoak.com> wrote in message
news:4138a5f6$1@.newsfeed.netlojix.com...
> Hi All,
> I have a question about CPU usage. Actually, I believe that SQL server
> isn't using as much as it could!
> I have dual Xeon machine (shows up as 4 CPUs to SQL server due to
> HyperThreading)
> No matter what queries I run, the CPU usage never goes above 25%. In
> the Enterprise Mangager, it's set to use CPUs 0 through 3, so I know
> that's not the issue. The number of processors is the same since I
> installed SQL server.
> I'm pretty sure that SQL Server is confused about something, as running
> updates on a million rows or doing selects on calculated fields never
> pushes it above 25%. I'm thinking SQL server for some reason thinks
> there's only one CPU. The odd thing in the Windows Task Manager is that
> it shows activity (low amounts) on each CPU.
> Am I not understanding something, or is this a real problem?|||Some selects could be faster... we're running some selects that take
about 30 seconds (which may be OK, but I want my money's worth from
those CPUs! :) ). Having a limit that it *NEVER* goes over just seems
suspicious to me. I'll monitor Perfmon for awhile as Andrew suggested,
and let you know if anything shows up. The discs don't seem to be
thrashing around so I'm not sure if it's a I/O problem, but you never
know...
What I keep thinking is that (100% one 1 cpu / 4 cpus) = 25%. If SQL
server is somehow working with only really using 1 of the 4, that seems
like something to look into. I'll check the more obvious stuff first,
though.
Narayana Vyas Kondreddi wrote:
> If your COU is not going beyond 25% then you should be happy about it :-)
> But you aren't. So, is something running slow? What makes you worry about
> your CPU utilization?|||Following up on the perfmon stuff...
Disk Write Time percentage is about 3% during a insertion run, total
disk time is about 9% during selects. CPU Max is always 25.00 %
BTW, the select run that never goes over 25% is in a stored procedure.
Stored Procedure compilations and recompilations aren't even
registering. The only thing I can see is a issue would be the number of
Lock Requests in SQL server per second. The max I hit is 90,000 when
it's really busy.
Chris Kuske wrote:
> Some selects could be faster... we're running some selects that take
> about 30 seconds (which may be OK, but I want my money's worth from
> those CPUs! :) ). Having a limit that it *NEVER* goes over just seems
> suspicious to me. I'll monitor Perfmon for awhile as Andrew suggested,
> and let you know if anything shows up. The discs don't seem to be
> thrashing around so I'm not sure if it's a I/O problem, but you never
> know...
> What I keep thinking is that (100% one 1 cpu / 4 cpus) = 25%. If SQL
> server is somehow working with only really using 1 of the 4, that seems
> like something to look into. I'll check the more obvious stuff first,
> though.
> Narayana Vyas Kondreddi wrote:
>> If your COU is not going beyond 25% then you should be happy about it :-)
>> But you aren't. So, is something running slow? What makes you worry about
>> your CPU utilization?|||Disk percentage is not the best counter to watch. Better to look at avg and
current disk queues. When you say CPU is 25% are you looking at the perfmon
counter for total cpu or theindividual ones? Make sure you have each cpu's
counter individually listed in perfmon so you can see if all processors are
being used or not. What about blocking? Does sp_who2 show anything with a
value other than 0 in the "blocked" column during this operation? Here are
some links that may help:
http://www.microsoft.com/sql/techinfo/administration/2000/perftuning.asp
Performance WP's
http://www.swynk.com/friends/vandenberg/perfmonitor.asp Perfmon counters
http://www.sql-server-performance.com/sql_server_performance_audit.asp
Hardware Performance CheckList
http://www.sql-server-performance.com/best_sql_server_performance_tips.asp
SQL 2000 Performance tuning tips
http://www.support.microsoft.com/?id=q224587 Troubleshooting App
Performance
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_perfmon_24u1.asp
Disk Monitoring
Andrew J. Kelly SQL MVP
"Chris Kuske" <chris@.solidoak.com> wrote in message
news:4138d387$1@.newsfeed.netlojix.com...
> Following up on the perfmon stuff...
> Disk Write Time percentage is about 3% during a insertion run, total
> disk time is about 9% during selects. CPU Max is always 25.00 %
> BTW, the select run that never goes over 25% is in a stored procedure.
> Stored Procedure compilations and recompilations aren't even
> registering. The only thing I can see is a issue would be the number of
> Lock Requests in SQL server per second. The max I hit is 90,000 when
> it's really busy.
> Chris Kuske wrote:
> > Some selects could be faster... we're running some selects that take
> > about 30 seconds (which may be OK, but I want my money's worth from
> > those CPUs! :) ). Having a limit that it *NEVER* goes over just seems
> > suspicious to me. I'll monitor Perfmon for awhile as Andrew suggested,
> > and let you know if anything shows up. The discs don't seem to be
> > thrashing around so I'm not sure if it's a I/O problem, but you never
> > know...
> >
> > What I keep thinking is that (100% one 1 cpu / 4 cpus) = 25%. If SQL
> > server is somehow working with only really using 1 of the 4, that seems
> > like something to look into. I'll check the more obvious stuff first,
> > though.
> >
> > Narayana Vyas Kondreddi wrote:
> >
> >> If your COU is not going beyond 25% then you should be happy about it
:-)
> >> But you aren't. So, is something running slow? What makes you worry
about
> >> your CPU utilization?|||Chris
I would recommend working on the individual query that you feel is not
running fast enough. Here are some pointers on how to work out if the query
is running optimally :
1. Update statistics on the underlying tables.
2. Run the query through Index Tuning Wizard to see if it provides any
index recommendations.
As mentioned by Andrew, its possible that you may have a bottleneck
somewhere else on the system and having fast cpu(s) may not be able to
address that bottleneck.
Thank you for using Microsoft newsgroups.
Sincerely
Pankaj Agarwal
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||Chris,
As Narayana mentioned, it can hardly be your goal to max out your CPU's.
Anyway, if you want to check your system, you can run the following
batch. A few seconds after the main SELECT query starts all your CPU's
will max out for 20 seconds or longer (depending on the number of CPU's
and their speed).
set quoted_identifier on
go
SELECT TOP 100000 OD1.ProductID+OD2.ProductID+OD1.Quantity AS
ProductID,REPLICATE('a',200) as Filler
INTO LargeTable1
FROM northwind.dbo."order details" OD1
CROSS JOIN northwind.dbo."order details" OD2
WHERE OD2.Quantity NOT BETWEEN 10 AND 15
SELECT TOP 100000 OD1.ProductID+OD2.ProductID+OD2.Quantity AS
ProductID,REPLICATE('a',200) as Filler
INTO LargeTable2
FROM northwind.dbo."order details" OD1
CROSS JOIN northwind.dbo."order details" OD2
WHERE OD1.Quantity < 40
go
SET SHOWPLAN_TEXT ON
go
SELECT LT1.ProductID,COUNT(*)
FROM LargeTable1 LT1
INNER JOIN LargeTable2 LT2
ON LT1.ProductID=LT2.ProductID
GROUP BY LT1.ProductID
go
SET SHOWPLAN_TEXT OFF
go
SET STATISTICS TIME ON
go
SELECT LT1.ProductID,COUNT(*)
FROM LargeTable1 LT1
INNER JOIN LargeTable2 LT2
ON LT1.ProductID=LT2.ProductID
GROUP BY LT1.ProductID
go
SET STATISTICS TIME OFF
go
-- On my machine with 2 Hyperthreaded CPU's
-- CPU time = 112471 ms, elapsed time = 31835 ms.
DROP TABLE LargeTable1
DROP TABLE LargeTable2
Hope this helps,
Gert-jan
Chris Kuske wrote:
> Some selects could be faster... we're running some selects that take
> about 30 seconds (which may be OK, but I want my money's worth from
> those CPUs! :) ). Having a limit that it *NEVER* goes over just seems
> suspicious to me. I'll monitor Perfmon for awhile as Andrew suggested,
> and let you know if anything shows up. The discs don't seem to be
> thrashing around so I'm not sure if it's a I/O problem, but you never
> know...
> What I keep thinking is that (100% one 1 cpu / 4 cpus) = 25%. If SQL
> server is somehow working with only really using 1 of the 4, that seems
> like something to look into. I'll check the more obvious stuff first,
> though.
> Narayana Vyas Kondreddi wrote:
> > If your COU is not going beyond 25% then you should be happy about it :-)
> > But you aren't. So, is something running slow? What makes you worry about
> > your CPU utilization?
--
(Please reply only to the newsgroup)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment