Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

disk I/O tool

 
Goto page Previous  1, 2
   Database Help (Home) -> Server RSS
Next:  isql run error after upgrade  
Author Message
TheSQLGuru

External


Since: Jan 11, 2008
Posts: 579



(Msg. 16) Posted: Sun Jan 03, 2010 12:39 pm
Post subject: Re: disk I/O tool [Login to view extended thread Info.]
Archived from groups: microsoft>public>sqlserver>server (more info?)

What I recommend is doing a differential analysis of the io stalls. They
are cumulative, and thus can mask real problems if those are of an
intermittent nature (which they almost always are).

Put your values in a temp table, waitfor delay 'someperiod', now join
current io stall output to the temp table and do a diff based on the time
spread. gets you actual period-based values which are much more meaningful
because you can run for say 5 or 10 minutes during a period you know to be
high-activity.

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net


"Jay" wrote in message

> I'll check the link out later, for now, I'm looking at:
>
> select db_name(mf.database_id) as databaseName, divfs.file_id,
> mf.physical_name,
> num_of_reads, num_of_bytes_read, io_stall_read_ms, num_of_writes,
> num_of_bytes_written, io_stall_write_ms, io_stall,size_on_disk_bytes
> from sys.dm_io_virtual_file_stats(null,null) as divfs
> inner join sys.master_files as mf
> on mf.database_id = divfs.database_id
> and mf.file_id = divfs.file_id
>
> While it is clear this is what you're refering to, I would like to be sure
> I'm reading the output right. Unfortunatly, I'm having a little trouble.
> But that may be because I only have my home system to look at right now.
>
> "Andrew J. Kelly" wrote in message
>
>>I don't think you will find an MS whitepaper on something like that. For
>>one there are too many variables and performance depends greatly on
>>configuration and load type. But there is no question that disk for disk a
>>SAN will never beat the performance of direct attached storage. The
>>advantages of the SAN are that it is more flexible and scalable in terms
>>of number of spindles and such. But the biggest down side is that it is
>>overrated and usually shared with other heavy loads. You might want to
>>have a look at these:
>>
>> http://sqlblogcasts.com/search/SearchResults.aspx?q=san+performance
>>
>> But don't underestimate the virtual file stats and what that can give
>> you. It will tell you if you are waiting or not.
>>
>> --
>>
>> Andrew J. Kelly SQL MVP
>> Solid Quality Mentors
>>
>> "Jay" wrote in message
>> news:#h52Hq6iKHA.2160@TK2MSFTNGP02.phx.gbl...
>>> Do you know of a Microsoft whitepaper that talks about SAN's being slow
>>> on small & frequent writes?
>>>
>>> "Andrew J. Kelly" wrote in message
>>>
>>>> Your best option to begin with is to look at the virtual file stats to
>>>> see how much physical I/O msdb is actually doing over a given time
>>>> period. It will also tell you how long it is taking to read and write
>>>> those I/O's and you can see if it is too long or not. I guess he really
>>>> doesn't understand SAN's very well either because SAN's are notoriously
>>>> slow for writing small but frequent I/O's and direct attached drives
>>>> will often outperform them hands down. If you are processing lots of
>>>> Service Broker messages then that can explain some of the activity. But
>>>> until you look at the file stats it is hard to say if it is handling it
>>>> properly or not.
>>>>
>>>> --
>>>>
>>>> Andrew J. Kelly SQL MVP
>>>> Solid Quality Mentors
>>>>
>>>> "Jay" wrote in message
>>>> news:#iwZMWxiKHA.1648@TK2MSFTNGP05.phx.gbl...
>>>>> Sigh, that has basically been my argument. However, the guy has stuck
>>>>> to his guns that his msdb is so active that the local drives aren't
>>>>> enough and that it must be on the SAN for performance reasons.
>>>>>
>>>>> The best I could think of was to stress a similar drive (and monitor
>>>>> it) to show what off the shelf SCSI's can do on an internal controller
>>>>> and that msdb activity just doesn't come close to the drive capacity.
>>>>> Perhaps SQLIO, being simpler, would be better.
>>>>>
>>>>> His DB seems to have a very large number of databases and each of
>>>>> these DB's seem to have a lot of SQL Agent jobs that fire frequently.
>>>>> This combined with heavy Message Broker activity is supposedly
>>>>> generating log writes, reads and I have no clue what, to produce the
>>>>> "heavy activity" that requires the SAN - which is RAID 5 BTW.
>>>>>
>>>>>
>>>>> "Andrew J. Kelly" wrote in message
>>>>>
>>>>>> Why would MSDB be that busy? If it really is you might want to see
>>>>>> why because it shouldn't be under normal circumstances. SQLIOSIM
>>>>>> simulates SQL IO patterns but is not really a measurement tool per
>>>>>> say. It is more to hammer the array and see where it breaks. If you
>>>>>> want to see how it actually performs in general reads & writes use
>>>>>> SQLIO.
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Andrew J. Kelly SQL MVP
>>>>>> Solid Quality Mentors
>>>>>>
>>>>>> "Jay" wrote in message
>>>>>>
>>>>>>> SQLIO++ will do.
>>>>>>>
>>>>>>> I'm in a discussion where a guy is saying msdb is so busy, that
>>>>>>> local SCSI drives don't have enough throughput and it has to be on
>>>>>>> the SAN (which is RAID 5 BTW). I was suggesting to him to run
>>>>>>> SQLIOsim to see what the monitors look like when the drive is
>>>>>>> hammered and to compare it to what he sees in his production
>>>>>>> environment.
>>>>>>>
>>>>>>> Jay
>>>>>>>
>>>>>>> "Andrew J. Kelly" wrote in message
>>>>>>>
>>>>>>>> It depends on what you want to accomplish as there are several. Can
>>>>>>>> you tell us what your goal is?
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Andrew J. Kelly SQL MVP
>>>>>>>> Solid Quality Mentors
>>>>>>>>
>>>>>>>> "Jay" wrote in message
>>>>>>>> news:#HfRsQciKHA.1648@TK2MSFTNGP05.phx.gbl...
>>>>>>>>> SQLIOsim, which the spell checker wants to change to Solipsism Smile
>>>>>>>>>
>>>>>>>>> "Jay" wrote in message
>>>>>>>>>
>>>>>>>>>> What is the name of that disk I/O tool?
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>

 >> Stay informed about: disk I/O tool 
Back to top
Login to vote
Andrew J. Kelly

External


Since: Sep 01, 2003
Posts: 551



(Msg. 17) Posted: Sun Jan 03, 2010 5:39 pm
Post subject: Re: disk I/O tool [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

As Kevin mentioned for the most part you need a SAN although there are some
smaller units that will support 2 node clustering from HP and maybe a few
others. But essentially they act like a SAN vs. direct attached storage.

--

Andrew J. Kelly SQL MVP
Solid Quality Mentors

"Jay" wrote in message
news:u#w6h2#iKHA.5608@TK2MSFTNGP05.phx.gbl...
> Just got though some of the links, OH MY!
>
> Just one question, when building a cluster, is there an alternative to a
> SAN?
>
> "Andrew J. Kelly" wrote in message
>
>>I don't think you will find an MS whitepaper on something like that. For
>>one there are too many variables and performance depends greatly on
>>configuration and load type. But there is no question that disk for disk a
>>SAN will never beat the performance of direct attached storage. The
>>advantages of the SAN are that it is more flexible and scalable in terms
>>of number of spindles and such. But the biggest down side is that it is
>>overrated and usually shared with other heavy loads. You might want to
>>have a look at these:
>>
>> http://sqlblogcasts.com/search/SearchResults.aspx?q=san+performance
>>
>> But don't underestimate the virtual file stats and what that can give
>> you. It will tell you if you are waiting or not.
>>
>> --
>>
>> Andrew J. Kelly SQL MVP
>> Solid Quality Mentors
>>
>> "Jay" wrote in message
>> news:#h52Hq6iKHA.2160@TK2MSFTNGP02.phx.gbl...
>>> Do you know of a Microsoft whitepaper that talks about SAN's being slow
>>> on small & frequent writes?
>>>
>>> "Andrew J. Kelly" wrote in message
>>>
>>>> Your best option to begin with is to look at the virtual file stats to
>>>> see how much physical I/O msdb is actually doing over a given time
>>>> period. It will also tell you how long it is taking to read and write
>>>> those I/O's and you can see if it is too long or not. I guess he really
>>>> doesn't understand SAN's very well either because SAN's are notoriously
>>>> slow for writing small but frequent I/O's and direct attached drives
>>>> will often outperform them hands down. If you are processing lots of
>>>> Service Broker messages then that can explain some of the activity. But
>>>> until you look at the file stats it is hard to say if it is handling it
>>>> properly or not.
>>>>
>>>> --
>>>>
>>>> Andrew J. Kelly SQL MVP
>>>> Solid Quality Mentors
>>>>
>>>> "Jay" wrote in message
>>>> news:#iwZMWxiKHA.1648@TK2MSFTNGP05.phx.gbl...
>>>>> Sigh, that has basically been my argument. However, the guy has stuck
>>>>> to his guns that his msdb is so active that the local drives aren't
>>>>> enough and that it must be on the SAN for performance reasons.
>>>>>
>>>>> The best I could think of was to stress a similar drive (and monitor
>>>>> it) to show what off the shelf SCSI's can do on an internal controller
>>>>> and that msdb activity just doesn't come close to the drive capacity.
>>>>> Perhaps SQLIO, being simpler, would be better.
>>>>>
>>>>> His DB seems to have a very large number of databases and each of
>>>>> these DB's seem to have a lot of SQL Agent jobs that fire frequently.
>>>>> This combined with heavy Message Broker activity is supposedly
>>>>> generating log writes, reads and I have no clue what, to produce the
>>>>> "heavy activity" that requires the SAN - which is RAID 5 BTW.
>>>>>
>>>>>
>>>>> "Andrew J. Kelly" wrote in message
>>>>>
>>>>>> Why would MSDB be that busy? If it really is you might want to see
>>>>>> why because it shouldn't be under normal circumstances. SQLIOSIM
>>>>>> simulates SQL IO patterns but is not really a measurement tool per
>>>>>> say. It is more to hammer the array and see where it breaks. If you
>>>>>> want to see how it actually performs in general reads & writes use
>>>>>> SQLIO.
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Andrew J. Kelly SQL MVP
>>>>>> Solid Quality Mentors
>>>>>>
>>>>>> "Jay" wrote in message
>>>>>>
>>>>>>> SQLIO++ will do.
>>>>>>>
>>>>>>> I'm in a discussion where a guy is saying msdb is so busy, that
>>>>>>> local SCSI drives don't have enough throughput and it has to be on
>>>>>>> the SAN (which is RAID 5 BTW). I was suggesting to him to run
>>>>>>> SQLIOsim to see what the monitors look like when the drive is
>>>>>>> hammered and to compare it to what he sees in his production
>>>>>>> environment.
>>>>>>>
>>>>>>> Jay
>>>>>>>
>>>>>>> "Andrew J. Kelly" wrote in message
>>>>>>>
>>>>>>>> It depends on what you want to accomplish as there are several. Can
>>>>>>>> you tell us what your goal is?
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Andrew J. Kelly SQL MVP
>>>>>>>> Solid Quality Mentors
>>>>>>>>
>>>>>>>> "Jay" wrote in message
>>>>>>>> news:#HfRsQciKHA.1648@TK2MSFTNGP05.phx.gbl...
>>>>>>>>> SQLIOsim, which the spell checker wants to change to Solipsism Smile
>>>>>>>>>
>>>>>>>>> "Jay" wrote in message
>>>>>>>>>
>>>>>>>>>> What is the name of that disk I/O tool?
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>

 >> Stay informed about: disk I/O tool 
Back to top
Login to vote
Jay

External


Since: Aug 26, 2007
Posts: 17



(Msg. 18) Posted: Sun Jan 03, 2010 5:39 pm
Post subject: Re: disk I/O tool [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

How do you tell which have the slower transfer rates? Reviews?

"Andrew J. Kelly" wrote in message

> As Kevin mentioned for the most part you need a SAN although there are
> some smaller units that will support 2 node clustering from HP and maybe a
> few others. But essentially they act like a SAN vs. direct attached
> storage.
>
> --
>
> Andrew J. Kelly SQL MVP
> Solid Quality Mentors
>
> "Jay" wrote in message
> news:u#w6h2#iKHA.5608@TK2MSFTNGP05.phx.gbl...
>> Just got though some of the links, OH MY!
>>
>> Just one question, when building a cluster, is there an alternative to a
>> SAN?
>>
>> "Andrew J. Kelly" wrote in message
>>
>>>I don't think you will find an MS whitepaper on something like that. For
>>>one there are too many variables and performance depends greatly on
>>>configuration and load type. But there is no question that disk for disk
>>>a SAN will never beat the performance of direct attached storage. The
>>>advantages of the SAN are that it is more flexible and scalable in terms
>>>of number of spindles and such. But the biggest down side is that it is
>>>overrated and usually shared with other heavy loads. You might want to
>>>have a look at these:
>>>
>>> http://sqlblogcasts.com/search/SearchResults.aspx?q=san+performance
>>>
>>> But don't underestimate the virtual file stats and what that can give
>>> you. It will tell you if you are waiting or not.
>>>
>>> --
>>>
>>> Andrew J. Kelly SQL MVP
>>> Solid Quality Mentors
>>>
>>> "Jay" wrote in message
>>> news:#h52Hq6iKHA.2160@TK2MSFTNGP02.phx.gbl...
>>>> Do you know of a Microsoft whitepaper that talks about SAN's being slow
>>>> on small & frequent writes?
>>>>
>>>> "Andrew J. Kelly" wrote in message
>>>>
>>>>> Your best option to begin with is to look at the virtual file stats to
>>>>> see how much physical I/O msdb is actually doing over a given time
>>>>> period. It will also tell you how long it is taking to read and write
>>>>> those I/O's and you can see if it is too long or not. I guess he
>>>>> really doesn't understand SAN's very well either because SAN's are
>>>>> notoriously slow for writing small but frequent I/O's and direct
>>>>> attached drives will often outperform them hands down. If you are
>>>>> processing lots of Service Broker messages then that can explain some
>>>>> of the activity. But until you look at the file stats it is hard to
>>>>> say if it is handling it properly or not.
>>>>>
>>>>> --
>>>>>
>>>>> Andrew J. Kelly SQL MVP
>>>>> Solid Quality Mentors
>>>>>
>>>>> "Jay" wrote in message
>>>>> news:#iwZMWxiKHA.1648@TK2MSFTNGP05.phx.gbl...
>>>>>> Sigh, that has basically been my argument. However, the guy has stuck
>>>>>> to his guns that his msdb is so active that the local drives aren't
>>>>>> enough and that it must be on the SAN for performance reasons.
>>>>>>
>>>>>> The best I could think of was to stress a similar drive (and monitor
>>>>>> it) to show what off the shelf SCSI's can do on an internal
>>>>>> controller and that msdb activity just doesn't come close to the
>>>>>> drive capacity. Perhaps SQLIO, being simpler, would be better.
>>>>>>
>>>>>> His DB seems to have a very large number of databases and each of
>>>>>> these DB's seem to have a lot of SQL Agent jobs that fire frequently.
>>>>>> This combined with heavy Message Broker activity is supposedly
>>>>>> generating log writes, reads and I have no clue what, to produce the
>>>>>> "heavy activity" that requires the SAN - which is RAID 5 BTW.
>>>>>>
>>>>>>
>>>>>> "Andrew J. Kelly" wrote in message
>>>>>>
>>>>>>> Why would MSDB be that busy? If it really is you might want to see
>>>>>>> why because it shouldn't be under normal circumstances. SQLIOSIM
>>>>>>> simulates SQL IO patterns but is not really a measurement tool per
>>>>>>> say. It is more to hammer the array and see where it breaks. If you
>>>>>>> want to see how it actually performs in general reads & writes use
>>>>>>> SQLIO.
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Andrew J. Kelly SQL MVP
>>>>>>> Solid Quality Mentors
>>>>>>>
>>>>>>> "Jay" wrote in message
>>>>>>>
>>>>>>>> SQLIO++ will do.
>>>>>>>>
>>>>>>>> I'm in a discussion where a guy is saying msdb is so busy, that
>>>>>>>> local SCSI drives don't have enough throughput and it has to be on
>>>>>>>> the SAN (which is RAID 5 BTW). I was suggesting to him to run
>>>>>>>> SQLIOsim to see what the monitors look like when the drive is
>>>>>>>> hammered and to compare it to what he sees in his production
>>>>>>>> environment.
>>>>>>>>
>>>>>>>> Jay
>>>>>>>>
>>>>>>>> "Andrew J. Kelly" wrote in message
>>>>>>>>
>>>>>>>>> It depends on what you want to accomplish as there are several.
>>>>>>>>> Can you tell us what your goal is?
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>> Andrew J. Kelly SQL MVP
>>>>>>>>> Solid Quality Mentors
>>>>>>>>>
>>>>>>>>> "Jay" wrote in message
>>>>>>>>> news:#HfRsQciKHA.1648@TK2MSFTNGP05.phx.gbl...
>>>>>>>>>> SQLIOsim, which the spell checker wants to change to Solipsism Smile
>>>>>>>>>>
>>>>>>>>>> "Jay" wrote in message
>>>>>>>>>>
>>>>>>>>>>> What is the name of that disk I/O tool?
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
 >> Stay informed about: disk I/O tool 
Back to top
Login to vote
Andrew J. Kelly

External


Since: Sep 01, 2003
Posts: 551



(Msg. 19) Posted: Sun Jan 03, 2010 5:41 pm
Post subject: Re: disk I/O tool [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You need a delta to get anything useful out of it. Here are some sps that
should get you started.

IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
OBJECT_ID(N'[dbo].[gather_wait_stats_2005]') and OBJECTPROPERTY([object_id],
N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[gather_wait_stats_2005] ;
go
CREATE PROCEDURE [dbo].[gather_wait_stats_2005] (@Clear INT = 0)

AS

SET NOCOUNT ON ;

DECLARE @DT DATETIME ;
SET @DT = GETDATE() ;

IF OBJECT_ID(N'[dbo].[wait_stats]',N'U') IS NULL
CREATE TABLE [dbo].[wait_stats]
([wait_type] nvarchar(60) not null,
[waiting_tasks_count] bigint not null,
[wait_time_ms] bigint not null,
[max_wait_time_ms] bigint not null,
[signal_wait_time_ms] bigint not null,
[capture_time] datetime not null default getdate()) ;

-- If 1 the clear out the wait_stats counters & the table
IF @Clear = 1
BEGIN
DBCC SQLPERF([sys.dm_os_wait_stats],clear) WITH no_infomsgs ;
TRUNCATE TABLE [dbo].[wait_stats] ;
END


INSERT INTO [dbo].[wait_stats] ([wait_type], [waiting_tasks_count],
[wait_time_ms], [max_wait_time_ms], [signal_wait_time_ms], [capture_time]) SELECT [wait_type], [waiting_tasks_count], [wait_time_ms], [max_wait_time_ms], [signal_wait_time_ms], @DT
FROM sys.dm_os_wait_stats ;

GO


IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
OBJECT_ID(N'[dbo].[report_wait_stats_2005]') and OBJECTPROPERTY([object_id],
N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[report_wait_stats_2005] ;
GO
CREATE PROCEDURE [dbo].[report_wait_stats_2005]
(@First_Time DATETIME = NULL
,@Last_Time DATETIME = NULL
,@UseOLEDB INT = 0)
/*
-- Date & time of the last sample to use
-- 0 = Dont include OLEDB waits, 1 = Include OLEDB waits
*/
AS

SET NOCOUNT ON ;

IF OBJECT_ID( N'[dbo].[wait_stats]',N'U') IS NULL
BEGIN
RAISERROR('Error [dbo].[wait_stats] table does not exist', 16, 1) WITH
NOWAIT ;
RETURN ;
END

DECLARE @Total_Wait numeric(20,1), @Total_SignalWait numeric(20,1),
@Total_ResourceWait numeric(20,1)
,@EndTime datetime, @Total_Requests Bigint ;

DECLARE @Waits TABLE ([wait_type] nvarchar(60) not null,
[waiting_tasks_count] bigint not null,
[wait_time_ms] bigint not null,
[max_wait_time_ms] bigint not null,
[signal_wait_time_ms] bigint not null,
[capture_time] datetime not null) ;

-- If no First time was specified then use the First sample
IF @First_Time IS NULL
SET @First_Time = (SELECT MIN([capture_time]) FROM [dbo].[wait_stats]) ;
ELSE
BEGIN
-- If the time was not specified exactly find the closest one
IF NOT EXISTS(SELECT * FROM [dbo].[wait_stats] WHERE [capture_time] =
@First_Time)
BEGIN
DECLARE @FT DATETIME ;
SET @FT = @First_Time ;

SET @First_Time = (SELECT MIN([capture_time]) FROM
[dbo].[wait_stats] WHERE [capture_time] <= @FT) ;
IF @First_Time IS NULL
SET @First_Time = (SELECT MIN([capture_time]) FROM
[dbo].[wait_stats] WHERE [capture_time] >= @FT) ;
END
END

-- If no Last time was specified then use the latest sample
IF @Last_Time IS NULL
SET @Last_Time = (SELECT MAX([capture_time]) FROM [dbo].[wait_stats]) ;
ELSE
BEGIN
-- If the time was not specified exactly find the closest one
IF NOT EXISTS(SELECT * FROM [dbo].[wait_stats] WHERE [capture_time] =
@Last_Time)
BEGIN
DECLARE @LT DATETIME ;
SET @LT = @Last_Time ;

SET @Last_Time = (SELECT MAX([capture_time]) FROM [dbo].[wait_stats]
WHERE [capture_time] <= @LT) ;
IF @Last_Time IS NULL
SET @Last_Time = (SELECT MIN([capture_time]) FROM
[dbo].[wait_stats] WHERE [capture_time] >= @LT) ;
END
END


-- Get the relevant waits
INSERT INTO @Waits ([wait_type], [waiting_tasks_count], [wait_time_ms],
[max_wait_time_ms], [signal_wait_time_ms], [capture_time])
SELECT [wait_type], [waiting_tasks_count], [wait_time_ms],
[max_wait_time_ms], [signal_wait_time_ms], [capture_time]
FROM [dbo].[wait_stats] WHERE [capture_time] = @Last_Time ;

IF @@ROWCOUNT = 0
BEGIN
RAISERROR('Error, there are no waits for the specified DateTime', 16, 1)
WITH NOWAIT ;
RETURN ;
END


-- Delete some of the misc types of waits and OLEDB if called for
IF @UseOLEDB = 0
DELETE FROM @Waits
WHERE [wait_type] IN
('CLR_SEMAPHORE','LAZYWRITER_SLEEP','RESOURCE_QUEUE','SLEEP_TASK','SLEEP_SYSTEMTASK',
'SQLTRACE_BUFFER_FLUSH','WAITFOR', 'BROKER_TASK_STOP',
'BROKER_RECEIVE_WAITFOR', 'OLEDB','CLR_MANUAL_EVENT', 'CLR_AUTO_EVENT' ) ;
ELSE
DELETE FROM @Waits
WHERE [wait_type] IN
('CLR_SEMAPHORE','LAZYWRITER_SLEEP','RESOURCE_QUEUE','SLEEP_TASK','SLEEP_SYSTEMTASK',
'SQLTRACE_BUFFER_FLUSH','WAITFOR', 'BROKER_TASK_STOP',
'BROKER_RECEIVE_WAITFOR','CLR_MANUAL_EVENT', 'CLR_AUTO_EVENT' ) ;

---- 'EXCHANGE',
----'REQUEST_FOR_DEADLOCK_SEARCH',
----'KSOURCE_WAKEUP',
----'BROKER_TRANSMITTER', 'BROKER_EVENTHANDLER', 'BROKER_RECEIVE_WAITFOR',
----'BROKER_TASK_STOP', 'ONDEMAND_TASK_QUEUE', 'CHKPT',
'DBMIRROR_WORKER_QUEUE', 'DBMIRRORING_CMD',
----'SLEEP_TASK', 'CLR_MANUAL_EVENT', 'CLR_AUTO_EVENT'


-- Get the delta
UPDATE a SET a.[waiting_tasks_count] = (a.[waiting_tasks_count] -
b.[waiting_tasks_count])
,a.[wait_time_ms] = (a.[wait_time_ms] - b.[wait_time_ms])
,a.[signal_wait_time_ms] = (a.[signal_wait_time_ms] -
b.[signal_wait_time_ms])
FROM @Waits AS a INNER JOIN [dbo].[wait_stats] AS b ON a.[wait_type] =
b.[wait_type]
AND b.[capture_time] = @First_Time ;


-- Get the totals
SELECT @Total_Wait = SUM([wait_time_ms]) + 1, @Total_SignalWait =
SUM([signal_wait_time_ms]) + 1
FROM @Waits ;

SET @Total_ResourceWait = (1 + @Total_Wait) - @Total_SignalWait ;

SET @Total_Requests = (SELECT SUM([waiting_tasks_count]) FROM @Waits) ;

INSERT INTO @Waits ([wait_type], [waiting_tasks_count], [wait_time_ms],
[max_wait_time_ms], [signal_wait_time_ms], [capture_time])
SELECT
'***Total***',@Total_Requests,@Total_Wait,0,@Total_SignalWait,@Last_Time ;


-- Display the results
SELECT @First_Time AS [Start Time], @Last_Time AS [End Time]
,CONVERT(varchar(50),@Last_Time - @First_Time,14) AS [Duration
(hh:mm:ss:ms)] ;

select [wait_type] AS [Wait Type]
,[waiting_tasks_count] AS [Requests]
,[wait_time_ms] AS [Total Wait Time (ms)]
,[max_wait_time_ms] AS [Max Wait Time (ms)]
,CAST(100 * [wait_time_ms] / @Total_Wait as numeric(20,1)) AS [% Waits]
,[wait_time_ms] - [signal_wait_time_ms] AS [Resource Waits (ms)]
,CAST(100 * ([wait_time_ms] - [signal_wait_time_ms]) / @Total_ResourceWait
as numeric(20,1)) AS [% Res Waits]
,[signal_wait_time_ms] AS [Signal Waits (ms)]
,CAST(100*[signal_wait_time_ms] / @Total_SignalWait as numeric(20,1)) AS [%
Signal Waits]
FROM @Waits
ORDER BY [Total Wait Time (ms)] DESC, [Wait Type] ;


GO

--

Andrew J. Kelly SQL MVP
Solid Quality Mentors

"Jay" wrote in message
news:OMgkFU#iKHA.2132@TK2MSFTNGP05.phx.gbl...
> I'll check the link out later, for now, I'm looking at:
>
> select db_name(mf.database_id) as databaseName, divfs.file_id,
> mf.physical_name,
> num_of_reads, num_of_bytes_read, io_stall_read_ms, num_of_writes,
> num_of_bytes_written, io_stall_write_ms, io_stall,size_on_disk_bytes
> from sys.dm_io_virtual_file_stats(null,null) as divfs
> inner join sys.master_files as mf
> on mf.database_id = divfs.database_id
> and mf.file_id = divfs.file_id
>
> While it is clear this is what you're refering to, I would like to be sure
> I'm reading the output right. Unfortunatly, I'm having a little trouble.
> But that may be because I only have my home system to look at right now.
>
 >> Stay informed about: disk I/O tool 
Back to top
Login to vote
Andrew J. Kelly

External


Since: Sep 01, 2003
Posts: 551



(Msg. 20) Posted: Sun Jan 03, 2010 10:47 pm
Post subject: Re: disk I/O tool [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

You can look at the vendors specs but the bottom line is the actual
throughput depends mainly on configuration and total load.

--

Andrew J. Kelly SQL MVP
Solid Quality Mentors

"Jay" wrote in message

> How do you tell which have the slower transfer rates? Reviews?
>
> "Andrew J. Kelly" wrote in message
>
>> As Kevin mentioned for the most part you need a SAN although there are
>> some smaller units that will support 2 node clustering from HP and maybe
>> a few others. But essentially they act like a SAN vs. direct attached
>> storage.
>>
>> --
>>
>> Andrew J. Kelly SQL MVP
>> Solid Quality Mentors
>>
>> "Jay" wrote in message
>> news:u#w6h2#iKHA.5608@TK2MSFTNGP05.phx.gbl...
>>> Just got though some of the links, OH MY!
>>>
>>> Just one question, when building a cluster, is there an alternative to a
>>> SAN?
>>>
>>> "Andrew J. Kelly" wrote in message
>>>
>>>>I don't think you will find an MS whitepaper on something like that. For
>>>>one there are too many variables and performance depends greatly on
>>>>configuration and load type. But there is no question that disk for disk
>>>>a SAN will never beat the performance of direct attached storage. The
>>>>advantages of the SAN are that it is more flexible and scalable in terms
>>>>of number of spindles and such. But the biggest down side is that it is
>>>>overrated and usually shared with other heavy loads. You might want to
>>>>have a look at these:
>>>>
>>>> http://sqlblogcasts.com/search/SearchResults.aspx?q=san+performance
>>>>
>>>> But don't underestimate the virtual file stats and what that can give
>>>> you. It will tell you if you are waiting or not.
>>>>
>>>> --
>>>>
>>>> Andrew J. Kelly SQL MVP
>>>> Solid Quality Mentors
>>>>
>>>> "Jay" wrote in message
>>>> news:#h52Hq6iKHA.2160@TK2MSFTNGP02.phx.gbl...
>>>>> Do you know of a Microsoft whitepaper that talks about SAN's being
>>>>> slow on small & frequent writes?
>>>>>
>>>>> "Andrew J. Kelly" wrote in message
>>>>>
>>>>>> Your best option to begin with is to look at the virtual file stats
>>>>>> to see how much physical I/O msdb is actually doing over a given time
>>>>>> period. It will also tell you how long it is taking to read and write
>>>>>> those I/O's and you can see if it is too long or not. I guess he
>>>>>> really doesn't understand SAN's very well either because SAN's are
>>>>>> notoriously slow for writing small but frequent I/O's and direct
>>>>>> attached drives will often outperform them hands down. If you are
>>>>>> processing lots of Service Broker messages then that can explain some
>>>>>> of the activity. But until you look at the file stats it is hard to
>>>>>> say if it is handling it properly or not.
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Andrew J. Kelly SQL MVP
>>>>>> Solid Quality Mentors
>>>>>>
>>>>>> "Jay" wrote in message
>>>>>> news:#iwZMWxiKHA.1648@TK2MSFTNGP05.phx.gbl...
>>>>>>> Sigh, that has basically been my argument. However, the guy has
>>>>>>> stuck to his guns that his msdb is so active that the local drives
>>>>>>> aren't enough and that it must be on the SAN for performance
>>>>>>> reasons.
>>>>>>>
>>>>>>> The best I could think of was to stress a similar drive (and monitor
>>>>>>> it) to show what off the shelf SCSI's can do on an internal
>>>>>>> controller and that msdb activity just doesn't come close to the
>>>>>>> drive capacity. Perhaps SQLIO, being simpler, would be better.
>>>>>>>
>>>>>>> His DB seems to have a very large number of databases and each of
>>>>>>> these DB's seem to have a lot of SQL Agent jobs that fire
>>>>>>> frequently. This combined with heavy Message Broker activity is
>>>>>>> supposedly generating log writes, reads and I have no clue what, to
>>>>>>> produce the "heavy activity" that requires the SAN - which is RAID 5
>>>>>>> BTW.
>>>>>>>
>>>>>>>
>>>>>>> "Andrew J. Kelly" wrote in message
>>>>>>>
>>>>>>>> Why would MSDB be that busy? If it really is you might want to see
>>>>>>>> why because it shouldn't be under normal circumstances. SQLIOSIM
>>>>>>>> simulates SQL IO patterns but is not really a measurement tool per
>>>>>>>> say. It is more to hammer the array and see where it breaks. If you
>>>>>>>> want to see how it actually performs in general reads & writes use
>>>>>>>> SQLIO.
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Andrew J. Kelly SQL MVP
>>>>>>>> Solid Quality Mentors
>>>>>>>>
>>>>>>>> "Jay" wrote in message
>>>>>>>>
>>>>>>>>> SQLIO++ will do.
>>>>>>>>>
>>>>>>>>> I'm in a discussion where a guy is saying msdb is so busy, that
>>>>>>>>> local SCSI drives don't have enough throughput and it has to be on
>>>>>>>>> the SAN (which is RAID 5 BTW). I was suggesting to him to run
>>>>>>>>> SQLIOsim to see what the monitors look like when the drive is
>>>>>>>>> hammered and to compare it to what he sees in his production
>>>>>>>>> environment.
>>>>>>>>>
>>>>>>>>> Jay
>>>>>>>>>
>>>>>>>>> "Andrew J. Kelly" wrote in message
>>>>>>>>>
>>>>>>>>>> It depends on what you want to accomplish as there are several.
>>>>>>>>>> Can you tell us what your goal is?
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> Andrew J. Kelly SQL MVP
>>>>>>>>>> Solid Quality Mentors
>>>>>>>>>>
>>>>>>>>>> "Jay" wrote in message
>>>>>>>>>> news:#HfRsQciKHA.1648@TK2MSFTNGP05.phx.gbl...
>>>>>>>>>>> SQLIOsim, which the spell checker wants to change to Solipsism
>>>>>>>>>>> Smile
>>>>>>>>>>>
>>>>>>>>>>> "Jay" wrote in message
>>>>>>>>>>>
>>>>>>>>>>>> What is the name of that disk I/O tool?
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
 >> Stay informed about: disk I/O tool 
Back to top
Login to vote
TheSQLGuru

External


Since: Jan 11, 2008
Posts: 579



(Msg. 21) Posted: Mon Jan 04, 2010 4:22 pm
Post subject: Re: disk I/O tool [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Did you mean to paste in the waitstats analysis code Andy? Smile

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net


"Andrew J. Kelly" wrote in message

> You need a delta to get anything useful out of it. Here are some sps that
> should get you started.
>
> IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
> OBJECT_ID(N'[dbo].[gather_wait_stats_2005]') and
> OBJECTPROPERTY([object_id], N'IsProcedure') = 1)
> DROP PROCEDURE [dbo].[gather_wait_stats_2005] ;
> go
> CREATE PROCEDURE [dbo].[gather_wait_stats_2005] (@Clear INT = 0)
>
> AS
>
> SET NOCOUNT ON ;
>
> DECLARE @DT DATETIME ;
> SET @DT = GETDATE() ;
>
> IF OBJECT_ID(N'[dbo].[wait_stats]',N'U') IS NULL
> CREATE TABLE [dbo].[wait_stats]
> ([wait_type] nvarchar(60) not null,
> [waiting_tasks_count] bigint not null,
> [wait_time_ms] bigint not null,
> [max_wait_time_ms] bigint not null,
> [signal_wait_time_ms] bigint not null,
> [capture_time] datetime not null default getdate()) ;
>
> -- If 1 the clear out the wait_stats counters & the table
> IF @Clear = 1
> BEGIN
> DBCC SQLPERF([sys.dm_os_wait_stats],clear) WITH no_infomsgs ;
> TRUNCATE TABLE [dbo].[wait_stats] ;
> END
>
>
> INSERT INTO [dbo].[wait_stats] ([wait_type], [waiting_tasks_count],
> [wait_time_ms], [max_wait_time_ms], [signal_wait_time_ms], [capture_time])
> SELECT [wait_type], [waiting_tasks_count], [wait_time_ms],
> [max_wait_time_ms], [signal_wait_time_ms], @DT
> FROM sys.dm_os_wait_stats ;
>
> GO
>
>
> IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
> OBJECT_ID(N'[dbo].[report_wait_stats_2005]') and
> OBJECTPROPERTY([object_id], N'IsProcedure') = 1)
> DROP PROCEDURE [dbo].[report_wait_stats_2005] ;
> GO
> CREATE PROCEDURE [dbo].[report_wait_stats_2005]
> (@First_Time DATETIME = NULL
> ,@Last_Time DATETIME = NULL
> ,@UseOLEDB INT = 0)
> /*
> -- Date & time of the last sample to use
> -- 0 = Dont include OLEDB waits, 1 = Include OLEDB waits
> */
> AS
>
> SET NOCOUNT ON ;
>
> IF OBJECT_ID( N'[dbo].[wait_stats]',N'U') IS NULL
> BEGIN
> RAISERROR('Error [dbo].[wait_stats] table does not exist', 16, 1) WITH
> NOWAIT ;
> RETURN ;
> END
>
> DECLARE @Total_Wait numeric(20,1), @Total_SignalWait numeric(20,1),
> @Total_ResourceWait numeric(20,1)
> ,@EndTime datetime, @Total_Requests Bigint ;
>
> DECLARE @Waits TABLE ([wait_type] nvarchar(60) not null,
> [waiting_tasks_count] bigint not null,
> [wait_time_ms] bigint not null,
> [max_wait_time_ms] bigint not null,
> [signal_wait_time_ms] bigint not null,
> [capture_time] datetime not null) ;
>
> -- If no First time was specified then use the First sample
> IF @First_Time IS NULL
> SET @First_Time = (SELECT MIN([capture_time]) FROM [dbo].[wait_stats])
> ;
> ELSE
> BEGIN
> -- If the time was not specified exactly find the closest one
> IF NOT EXISTS(SELECT * FROM [dbo].[wait_stats] WHERE [capture_time] =
> @First_Time)
> BEGIN
> DECLARE @FT DATETIME ;
> SET @FT = @First_Time ;
>
> SET @First_Time = (SELECT MIN([capture_time]) FROM
> [dbo].[wait_stats] WHERE [capture_time] <= @FT) ;
> IF @First_Time IS NULL
> SET @First_Time = (SELECT MIN([capture_time]) FROM
> [dbo].[wait_stats] WHERE [capture_time] >= @FT) ;
> END
> END
>
> -- If no Last time was specified then use the latest sample
> IF @Last_Time IS NULL
> SET @Last_Time = (SELECT MAX([capture_time]) FROM [dbo].[wait_stats]) ;
> ELSE
> BEGIN
> -- If the time was not specified exactly find the closest one
> IF NOT EXISTS(SELECT * FROM [dbo].[wait_stats] WHERE [capture_time] =
> @Last_Time)
> BEGIN
> DECLARE @LT DATETIME ;
> SET @LT = @Last_Time ;
>
> SET @Last_Time = (SELECT MAX([capture_time]) FROM
> [dbo].[wait_stats] WHERE [capture_time] <= @LT) ;
> IF @Last_Time IS NULL
> SET @Last_Time = (SELECT MIN([capture_time]) FROM
> [dbo].[wait_stats] WHERE [capture_time] >= @LT) ;
> END
> END
>
>
> -- Get the relevant waits
> INSERT INTO @Waits ([wait_type], [waiting_tasks_count], [wait_time_ms],
> [max_wait_time_ms], [signal_wait_time_ms], [capture_time])
> SELECT [wait_type], [waiting_tasks_count], [wait_time_ms],
> [max_wait_time_ms], [signal_wait_time_ms], [capture_time]
> FROM [dbo].[wait_stats] WHERE [capture_time] = @Last_Time ;
>
> IF @@ROWCOUNT = 0
> BEGIN
> RAISERROR('Error, there are no waits for the specified DateTime', 16,
> 1) WITH NOWAIT ;
> RETURN ;
> END
>
>
> -- Delete some of the misc types of waits and OLEDB if called for
> IF @UseOLEDB = 0
> DELETE FROM @Waits
> WHERE [wait_type] IN
> ('CLR_SEMAPHORE','LAZYWRITER_SLEEP','RESOURCE_QUEUE','SLEEP_TASK','SLEEP_SYSTEMTASK',
> 'SQLTRACE_BUFFER_FLUSH','WAITFOR', 'BROKER_TASK_STOP',
> 'BROKER_RECEIVE_WAITFOR', 'OLEDB','CLR_MANUAL_EVENT', 'CLR_AUTO_EVENT' ) ;
> ELSE
> DELETE FROM @Waits
> WHERE [wait_type] IN
> ('CLR_SEMAPHORE','LAZYWRITER_SLEEP','RESOURCE_QUEUE','SLEEP_TASK','SLEEP_SYSTEMTASK',
> 'SQLTRACE_BUFFER_FLUSH','WAITFOR', 'BROKER_TASK_STOP',
> 'BROKER_RECEIVE_WAITFOR','CLR_MANUAL_EVENT', 'CLR_AUTO_EVENT' ) ;
>
> ---- 'EXCHANGE',
> ----'REQUEST_FOR_DEADLOCK_SEARCH',
> ----'KSOURCE_WAKEUP',
> ----'BROKER_TRANSMITTER', 'BROKER_EVENTHANDLER', 'BROKER_RECEIVE_WAITFOR',
> ----'BROKER_TASK_STOP', 'ONDEMAND_TASK_QUEUE', 'CHKPT',
> 'DBMIRROR_WORKER_QUEUE', 'DBMIRRORING_CMD',
> ----'SLEEP_TASK', 'CLR_MANUAL_EVENT', 'CLR_AUTO_EVENT'
>
>
> -- Get the delta
> UPDATE a SET a.[waiting_tasks_count] = (a.[waiting_tasks_count] -
> b.[waiting_tasks_count])
> ,a.[wait_time_ms] = (a.[wait_time_ms] - b.[wait_time_ms])
> ,a.[signal_wait_time_ms] = (a.[signal_wait_time_ms] -
> b.[signal_wait_time_ms])
> FROM @Waits AS a INNER JOIN [dbo].[wait_stats] AS b ON a.[wait_type] =
> b.[wait_type]
> AND b.[capture_time] = @First_Time ;
>
>
> -- Get the totals
> SELECT @Total_Wait = SUM([wait_time_ms]) + 1, @Total_SignalWait =
> SUM([signal_wait_time_ms]) + 1
> FROM @Waits ;
>
> SET @Total_ResourceWait = (1 + @Total_Wait) - @Total_SignalWait ;
>
> SET @Total_Requests = (SELECT SUM([waiting_tasks_count]) FROM @Waits) ;
>
> INSERT INTO @Waits ([wait_type], [waiting_tasks_count], [wait_time_ms],
> [max_wait_time_ms], [signal_wait_time_ms], [capture_time])
> SELECT
> '***Total***',@Total_Requests,@Total_Wait,0,@Total_SignalWait,@Last_Time ;
>
>
> -- Display the results
> SELECT @First_Time AS [Start Time], @Last_Time AS [End Time]
> ,CONVERT(varchar(50),@Last_Time - @First_Time,14) AS [Duration
> (hh:mm:ss:ms)] ;
>
> select [wait_type] AS [Wait Type]
> ,[waiting_tasks_count] AS [Requests]
> ,[wait_time_ms] AS [Total Wait Time (ms)]
> ,[max_wait_time_ms] AS [Max Wait Time (ms)]
> ,CAST(100 * [wait_time_ms] / @Total_Wait as numeric(20,1)) AS [% Waits]
> ,[wait_time_ms] - [signal_wait_time_ms] AS [Resource Waits (ms)]
> ,CAST(100 * ([wait_time_ms] - [signal_wait_time_ms]) / @Total_ResourceWait
> as numeric(20,1)) AS [% Res Waits]
> ,[signal_wait_time_ms] AS [Signal Waits (ms)]
> ,CAST(100*[signal_wait_time_ms] / @Total_SignalWait as numeric(20,1)) AS
> [% Signal Waits]
> FROM @Waits
> ORDER BY [Total Wait Time (ms)] DESC, [Wait Type] ;
>
>
> GO
>
> --
>
> Andrew J. Kelly SQL MVP
> Solid Quality Mentors
>
> "Jay" wrote in message
> news:OMgkFU#iKHA.2132@TK2MSFTNGP05.phx.gbl...
>> I'll check the link out later, for now, I'm looking at:
>>
>> select db_name(mf.database_id) as databaseName, divfs.file_id,
>> mf.physical_name,
>> num_of_reads, num_of_bytes_read, io_stall_read_ms, num_of_writes,
>> num_of_bytes_written, io_stall_write_ms, io_stall,size_on_disk_bytes
>> from sys.dm_io_virtual_file_stats(null,null) as divfs
>> inner join sys.master_files as mf
>> on mf.database_id = divfs.database_id
>> and mf.file_id = divfs.file_id
>>
>> While it is clear this is what you're refering to, I would like to be
>> sure I'm reading the output right. Unfortunatly, I'm having a little
>> trouble. But that may be because I only have my home system to look at
>> right now.
>>
>
>
 >> Stay informed about: disk I/O tool 
Back to top
Login to vote
TheSQLGuru

External


Since: Jan 11, 2008
Posts: 579



(Msg. 22) Posted: Mon Jan 04, 2010 4:23 pm
Post subject: Re: disk I/O tool [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I think it is time to recommend you get a perf tuning professional onboard
to help out. There are a kajillion ways you can screw up an IO subsystem,
and it is a darn shame that almost everyone out there does most of the
things wrong.

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net


"Jay" wrote in message

> How do you tell which have the slower transfer rates? Reviews?
>
> "Andrew J. Kelly" wrote in message
>
>> As Kevin mentioned for the most part you need a SAN although there are
>> some smaller units that will support 2 node clustering from HP and maybe
>> a few others. But essentially they act like a SAN vs. direct attached
>> storage.
>>
>> --
>>
>> Andrew J. Kelly SQL MVP
>> Solid Quality Mentors
>>
>> "Jay" wrote in message
>> news:u#w6h2#iKHA.5608@TK2MSFTNGP05.phx.gbl...
>>> Just got though some of the links, OH MY!
>>>
>>> Just one question, when building a cluster, is there an alternative to a
>>> SAN?
>>>
>>> "Andrew J. Kelly" wrote in message
>>>
>>>>I don't think you will find an MS whitepaper on something like that. For
>>>>one there are too many variables and performance depends greatly on
>>>>configuration and load type. But there is no question that disk for disk
>>>>a SAN will never beat the performance of direct attached storage. The
>>>>advantages of the SAN are that it is more flexible and scalable in terms
>>>>of number of spindles and such. But the biggest down side is that it is
>>>>overrated and usually shared with other heavy loads. You might want to
>>>>have a look at these:
>>>>
>>>> http://sqlblogcasts.com/search/SearchResults.aspx?q=san+performance
>>>>
>>>> But don't underestimate the virtual file stats and what that can give
>>>> you. It will tell you if you are waiting or not.
>>>>
>>>> --
>>>>
>>>> Andrew J. Kelly SQL MVP
>>>> Solid Quality Mentors
>>>>
>>>> "Jay" wrote in message
>>>> news:#h52Hq6iKHA.2160@TK2MSFTNGP02.phx.gbl...
>>>>> Do you know of a Microsoft whitepaper that talks about SAN's being
>>>>> slow on small & frequent writes?
>>>>>
>>>>> "Andrew J. Kelly" wrote in message
>>>>>
>>>>>> Your best option to begin with is to look at the virtual file stats
>>>>>> to see how much physical I/O msdb is actually doing over a given time
>>>>>> period. It will also tell you how long it is taking to read and write
>>>>>> those I/O's and you can see if it is too long or not. I guess he
>>>>>> really doesn't understand SAN's very well either because SAN's are
>>>>>> notoriously slow for writing small but frequent I/O's and direct
>>>>>> attached drives will often outperform them hands down. If you are
>>>>>> processing lots of Service Broker messages then that can explain some
>>>>>> of the activity. But until you look at the file stats it is hard to
>>>>>> say if it is handling it properly or not.
>>>>>>
>>>>>> --
>>>>>>
>>>>>> Andrew J. Kelly SQL MVP
>>>>>> Solid Quality Mentors
>>>>>>
>>>>>> "Jay" wrote in message
>>>>>> news:#iwZMWxiKHA.1648@TK2MSFTNGP05.phx.gbl...
>>>>>>> Sigh, that has basically been my argument. However, the guy has
>>>>>>> stuck to his guns that his msdb is so active that the local drives
>>>>>>> aren't enough and that it must be on the SAN for performance
>>>>>>> reasons.
>>>>>>>
>>>>>>> The best I could think of was to stress a similar drive (and monitor
>>>>>>> it) to show what off the shelf SCSI's can do on an internal
>>>>>>> controller and that msdb activity just doesn't come close to the
>>>>>>> drive capacity. Perhaps SQLIO, being simpler, would be better.
>>>>>>>
>>>>>>> His DB seems to have a very large number of databases and each of
>>>>>>> these DB's seem to have a lot of SQL Agent jobs that fire
>>>>>>> frequently. This combined with heavy Message Broker activity is
>>>>>>> supposedly generating log writes, reads and I have no clue what, to
>>>>>>> produce the "heavy activity" that requires the SAN - which is RAID 5
>>>>>>> BTW.
>>>>>>>
>>>>>>>
>>>>>>> "Andrew J. Kelly" wrote in message
>>>>>>>
>>>>>>>> Why would MSDB be that busy? If it really is you might want to see
>>>>>>>> why because it shouldn't be under normal circumstances. SQLIOSIM
>>>>>>>> simulates SQL IO patterns but is not really a measurement tool per
>>>>>>>> say. It is more to hammer the array and see where it breaks. If you
>>>>>>>> want to see how it actually performs in general reads & writes use
>>>>>>>> SQLIO.
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>> Andrew J. Kelly SQL MVP
>>>>>>>> Solid Quality Mentors
>>>>>>>>
>>>>>>>> "Jay" wrote in message
>>>>>>>>
>>>>>>>>> SQLIO++ will do.
>>>>>>>>>
>>>>>>>>> I'm in a discussion where a guy is saying msdb is so busy, that
>>>>>>>>> local SCSI drives don't have enough throughput and it has to be on
>>>>>>>>> the SAN (which is RAID 5 BTW). I was suggesting to him to run
>>>>>>>>> SQLIOsim to see what the monitors look like when the drive is
>>>>>>>>> hammered and to compare it to what he sees in his production
>>>>>>>>> environment.
>>>>>>>>>
>>>>>>>>> Jay
>>>>>>>>>
>>>>>>>>> "Andrew J. Kelly" wrote in message
>>>>>>>>>
>>>>>>>>>> It depends on what you want to accomplish as there are several.
>>>>>>>>>> Can you tell us what your goal is?
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>> Andrew J. Kelly SQL MVP
>>>>>>>>>> Solid Quality Mentors
>>>>>>>>>>
>>>>>>>>>> "Jay" wrote in message
>>>>>>>>>> news:#HfRsQciKHA.1648@TK2MSFTNGP05.phx.gbl...
>>>>>>>>>>> SQLIOsim, which the spell checker wants to change to Solipsism
>>>>>>>>>>> Smile
>>>>>>>>>>>
>>>>>>>>>>> "Jay" wrote in message
>>>>>>>>>>>
>>>>>>>>>>>> What is the name of that disk I/O tool?
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
 >> Stay informed about: disk I/O tool 
Back to top
Login to vote
Andrew J. Kelly

External


Since: Sep 01, 2003
Posts: 551



(Msg. 23) Posted: Tue Jan 05, 2010 11:28 am
Post subject: Re: disk I/O tool [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Sorry thanks for pointing that out Kevin. While wait stats are good too here
is what I meant to post:

IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
OBJECT_ID(N'[dbo].[gather_file_stats_2005]') AND OBJECTPROPERTY([object_id],
N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[gather_file_stats_2005] ;
go
CREATE PROCEDURE [dbo].[gather_file_stats_2005] (@Clear INT = 0)

AS

SET NOCOUNT ON ;

DECLARE @DT DATETIME ;
SET @DT = GETDATE() ;

IF OBJECT_ID(N'[dbo].[file_stats]',N'U') IS NULL
CREATE TABLE [dbo].[file_stats](
[database_id] [smallint] NOT NULL,
[file_id] [smallint] NOT NULL,
[num_of_reads] [bigint] NOT NULL,
[num_of_bytes_read] [bigint] NOT NULL,
[io_stall_read_ms] [bigint] NOT NULL,
[num_of_writes] [bigint] NOT NULL,
[num_of_bytes_written] [bigint] NOT NULL,
[io_stall_write_ms] [bigint] NOT NULL,
[io_stall] [bigint] NOT NULL,
[size_on_disk_bytes] [bigint] NOT NULL,
[capture_time] [datetime] NOT NULL
) ;


-- If 1 the clear out the table
IF @Clear = 1
BEGIN
TRUNCATE TABLE [dbo].[file_stats] ;
END


INSERT INTO [dbo].[file_stats]
([database_id]
,[file_id]
,[num_of_reads]
,[num_of_bytes_read]
,[io_stall_read_ms]
,[num_of_writes]
,[num_of_bytes_written]
,[io_stall_write_ms]
,[io_stall]
,[size_on_disk_bytes]
,[capture_time])
SELECT [database_id]
,[file_id]
,[num_of_reads]
,[num_of_bytes_read]
,[io_stall_read_ms]
,[num_of_writes]
,[num_of_bytes_written]
,[io_stall_write_ms]
,[io_stall]
,[size_on_disk_bytes]
,@DT
FROM [sys].dm_io_virtual_file_stats(NULL,NULL) ;

GO


IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
OBJECT_ID(N'[dbo].[report_file_stats_2005]') and OBJECTPROPERTY([object_id],
N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[report_file_stats_2005] ;
GO
CREATE PROCEDURE [dbo].[report_file_stats_2005]
( @EndTime DATETIME = NULL
, @BeginTime DATETIME = NULL )
-- Date & time of the last sample to use

AS

SET NOCOUNT ON ;

IF OBJECT_ID( N'[dbo].[file_stats]',N'U') IS NULL
BEGIN
RAISERROR('Error [dbo].[file_stats] table does not exist', 16, 1) WITH
NOWAIT ;
RETURN ;
END

DECLARE @file_stats TABLE (
[database_id] [smallint] NOT NULL,
[file_id] [smallint] NOT NULL,
[num_of_reads] [bigint] NOT NULL,
[num_of_bytes_read] [bigint] NOT NULL,
[io_stall_read_ms] [bigint] NOT NULL,
[num_of_writes] [bigint] NOT NULL,
[num_of_bytes_written] [bigint] NOT NULL,
[io_stall_write_ms] [bigint] NOT NULL,
[io_stall] [bigint] NOT NULL,
[size_on_disk_bytes] [bigint] NOT NULL,
[capture_time] [datetime] NOT NULL
) ;

-- If no time was specified then use the latest sample minus the first
sample
IF @BeginTime IS NULL
SET @BeginTime = (SELECT MIN([capture_time]) FROM [dbo].[file_stats]) ;
ELSE
BEGIN
-- If the time was not specified exactly find the closest one
IF NOT EXISTS(SELECT * FROM [dbo].[file_stats] WHERE [capture_time] =
@BeginTime)
BEGIN
DECLARE @BT DATETIME ;
SET @BT = @BeginTime ;

SET @BeginTime = (SELECT MIN([capture_time]) FROM [dbo].[file_stats]
WHERE [capture_time] >= @BT) ;
IF @BeginTime IS NULL
SET @BeginTime = (SELECT MAX([capture_time]) FROM
[dbo].[file_stats] WHERE [capture_time] <= @BT) ;
END
END

IF @EndTime IS NULL
SET @EndTime = (SELECT MAX([capture_time]) FROM [dbo].[file_stats]) ;
ELSE
BEGIN
-- If the time was not specified exactly find the closest one
IF NOT EXISTS(SELECT * FROM [dbo].[file_stats] WHERE [capture_time] =
@EndTime)
BEGIN
DECLARE @ET DATETIME ;
SET @ET = @EndTime ;

SET @EndTime = (SELECT MIN([capture_time]) FROM [dbo].[file_stats]
WHERE [capture_time] >= @ET) ;
IF @EndTime IS NULL
SET @EndTime = (SELECT MAX([capture_time]) FROM
[dbo].[file_stats] WHERE [capture_time] <= @ET) ;
END
END


INSERT INTO @file_stats
([database_id],[file_id],[num_of_reads],[num_of_bytes_read],[io_stall_read_ms]
,[num_of_writes],[num_of_bytes_written],[io_stall_write_ms]
,[io_stall],[size_on_disk_bytes],[capture_time])
SELECT
[database_id],[file_id],[num_of_reads],[num_of_bytes_read],[io_stall_read_ms]
,[num_of_writes],[num_of_bytes_written],[io_stall_write_ms]
,[io_stall],[size_on_disk_bytes],[capture_time]
FROM [dbo].[file_stats]
WHERE [capture_time] = @EndTime ;

IF @@ROWCOUNT = 0
BEGIN
RAISERROR('Error, there are no waits for the specified DateTime', 16, 1)
WITH NOWAIT ;
RETURN ;
END

-- Subtract the starting numbers from the end ones to find the difference
for that time period
UPDATE fs
SET fs.[num_of_reads] = (fs.[num_of_reads] - a.[num_of_reads])
, fs.[num_of_bytes_read] = (fs.[num_of_bytes_read] -
a.[num_of_bytes_read])
, fs.[io_stall_read_ms] = (fs.[io_stall_read_ms] -
a.[io_stall_read_ms])
, fs.[num_of_writes] = (fs.[num_of_writes] - a.[num_of_writes])
, fs.[num_of_bytes_written] = (fs.[num_of_bytes_written] -
a.[num_of_bytes_written])
, fs.[io_stall_write_ms] = (fs.[io_stall_write_ms] -
a.[io_stall_write_ms])
, fs.[io_stall] = (fs.[io_stall] - a.[io_stall])
FROM @file_stats AS fs INNER JOIN (SELECT
b.[database_id],b.[file_id],b.[num_of_reads],b.[num_of_bytes_read],b.[io_stall_read_ms]
,b.[num_of_writes],b.[num_of_bytes_written],b.[io_stall_write_ms],b.[io_stall]
FROM [dbo].[file_stats] AS b
WHERE b.[capture_time] = @BeginTime)
AS a
ON (fs.[database_id] = a.[database_id] AND fs.[file_id]
= a.[file_id]) ;



SELECT CONVERT(varchar(50),@BeginTime,120) AS [Start Time],
CONVERT(varchar(50),@EndTime,120) AS [End Time]
,CONVERT(varchar(50),@EndTime - @BeginTime,108) AS [Duration (hh:mm:ss)]
;



SELECT fs.[database_id] AS [Database ID], fs.[file_id] AS [File ID],
fs.[num_of_reads] AS [NumberReads],
CONVERT(VARCHAR(20),CAST((fs.[num_of_bytes_read] / 1048576.0) AS
MONEY),1) AS [MBs Read]
,fs.[io_stall_read_ms] AS [IoStallReadMS]
,fs.[num_of_writes] AS [NumberWrites]
,CONVERT(VARCHAR(20),CAST((fs.[num_of_bytes_written] / 1048576.0) AS
MONEY),1) AS [MBs Written]
,fs.[io_stall_write_ms] AS [IoStallWriteMS]
,fs.[io_stall] AS [IoStallMS]
,CONVERT(VARCHAR(20),CAST((fs.[size_on_disk_bytes] / 1048576.0) AS
MONEY),1) AS [MBsOnDisk]
,(SELECT c.[name] FROM [master].[sys].[databases] AS c WHERE
c.[database_id] = fs.[database_id]) AS [DB Name]
,(SELECT
RIGHT(d.[physical_name],CHARINDEX('\',REVERSE(d.[physical_name]))-1)
FROM [master].[sys].[master_files] AS d
WHERE d.[file_id] = fs.[file_id] AND d.[database_id] =
fs.[database_id]) AS [File Name]
,fs.[capture_time] AS [Last Sample]
FROM @file_stats AS fs
ORDER BY fs.[database_id], fs.[file_id] ;


GO
 >> Stay informed about: disk I/O tool 
Back to top
Login to vote
Gary Rumble

External


Since: Jul 12, 2010
Posts: 1



(Msg. 24) Posted: Mon Jul 12, 2010 7:50 pm
Post subject: Negative results [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I'm using the file stat query from the previous post (I found it in an article that I can't locate).

I'm getting negative numbers in several of my result columns.

E.g.

Number of reads: 10
MBs read: 0.11
IoStallReadMS: -1301
....
IoStallMS: -959

File Name: Scrabble_log.ldf

Does this make sense?




Andrew J. Kelly wrote:

Sorry thanks for pointing that out Kevin.
05-Jan-10

Sorry thanks for pointing that out Kevin. While wait stats are good too here
is what I meant to post:

IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
OBJECT_ID(N'[dbo].[gather_file_stats_2005]') AND OBJECTPROPERTY([object_id],
N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[gather_file_stats_2005] ;
go
CREATE PROCEDURE [dbo].[gather_file_stats_2005] (@Clear INT = 0)

AS

SET NOCOUNT ON ;

DECLARE @DT DATETIME ;
SET @DT = GETDATE() ;

IF OBJECT_ID(N'[dbo].[file_stats]',N'U') IS NULL
CREATE TABLE [dbo].[file_stats](
[database_id] [smallint] NOT NULL,
[file_id] [smallint] NOT NULL,
[num_of_reads] [bigint] NOT NULL,
[num_of_bytes_read] [bigint] NOT NULL,
[io_stall_read_ms] [bigint] NOT NULL,
[num_of_writes] [bigint] NOT NULL,
[num_of_bytes_written] [bigint] NOT NULL,
[io_stall_write_ms] [bigint] NOT NULL,
[io_stall] [bigint] NOT NULL,
[size_on_disk_bytes] [bigint] NOT NULL,
[capture_time] [datetime] NOT NULL
) ;


-- If 1 the clear out the table
IF @Clear = 1
BEGIN
TRUNCATE TABLE [dbo].[file_stats] ;
END


INSERT INTO [dbo].[file_stats]
([database_id]
,[file_id]
,[num_of_reads]
,[num_of_bytes_read]
,[io_stall_read_ms]
,[num_of_writes]
,[num_of_bytes_written]
,[io_stall_write_ms]
,[io_stall]
,[size_on_disk_bytes]
,[capture_time])
SELECT [database_id]
,[file_id]
,[num_of_reads]
,[num_of_bytes_read]
,[io_stall_read_ms]
,[num_of_writes]
,[num_of_bytes_written]
,[io_stall_write_ms]
,[io_stall]
,[size_on_disk_bytes]
,@DT
FROM [sys].dm_io_virtual_file_stats(NULL,NULL) ;

GO


IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
OBJECT_ID(N'[dbo].[report_file_stats_2005]') and OBJECTPROPERTY([object_id],
N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[report_file_stats_2005] ;
GO
CREATE PROCEDURE [dbo].[report_file_stats_2005]
( @EndTime DATETIME = NULL
, @BeginTime DATETIME = NULL )
-- Date & time of the last sample to use

AS

SET NOCOUNT ON ;

IF OBJECT_ID( N'[dbo].[file_stats]',N'U') IS NULL
BEGIN
RAISERROR('Error [dbo].[file_stats] table does not exist', 16, 1) WITH
NOWAIT ;
RETURN ;
END

DECLARE @file_stats TABLE (
[database_id] [smallint] NOT NULL,
[file_id] [smallint] NOT NULL,
[num_of_reads] [bigint] NOT NULL,
[num_of_bytes_read] [bigint] NOT NULL,
[io_stall_read_ms] [bigint] NOT NULL,
[num_of_writes] [bigint] NOT NULL,
[num_of_bytes_written] [bigint] NOT NULL,
[io_stall_write_ms] [bigint] NOT NULL,
[io_stall] [bigint] NOT NULL,
[size_on_disk_bytes] [bigint] NOT NULL,

Previous Posts In This Thread:

On Wednesday, December 30, 2009 9:29 PM
Jay wrote:

disk I/O tool
What is the name of that disk I/O tool?

On Wednesday, December 30, 2009 9:51 PM
Jay wrote:

SQLIOsim, which the spell checker wants to change to Solipsism Smile
SQLIOsim, which the spell checker wants to change to Solipsism Smile

On Wednesday, December 30, 2009 10:53 PM
TheSQLGuru wrote:

There is also SQLIO and IOMeter.--Kevin G. BolesIndicium Resources, Inc.
There is also SQLIO and IOMeter.

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net

On Wednesday, December 30, 2009 11:12 PM
Abba wrote:

LOL Smile
LOL Smile

On Thursday, December 31, 2009 9:04 AM
Andrew J. Kelly wrote:

It depends on what you want to accomplish as there are several.
It depends on what you want to accomplish as there are several. Can you tell
us what your goal is?

--

Andrew J. Kelly SQL MVP
Solid Quality Mentors

On Thursday, December 31, 2009 6:48 PM
Jay wrote:

SQLIO++ will do.
SQLIO++ will do.

I am in a discussion where a guy is saying msdb is so busy, that local SCSI
drives do not have enough throughput and it has to be on the SAN (which is
RAID 5 BTW). I was suggesting to him to run SQLIOsim to see what the
monitors look like when the drive is hammered and to compare it to what he
sees in his production environment.

Jay

On Friday, January 01, 2010 9:19 AM
Andrew J. Kelly wrote:

Why would MSDB be that busy?
Why would MSDB be that busy? If it really is you might want to see why
because it should not be under normal circumstances. SQLIOSIM simulates SQL
IO patterns but is not really a measurement tool per say. It is more to
hammer the array and see where it breaks. If you want to see how it actually
performs in general reads & writes use SQLIO.

--

Andrew J. Kelly SQL MVP
Solid Quality Mentors

On Friday, January 01, 2010 2:06 PM
Jay wrote:

Sigh, that has basically been my argument.
Sigh, that has basically been my argument. However, the guy has stuck to his
guns that his msdb is so active that the local drives are not enough and that
it must be on the SAN for performance reasons.

The best I could think of was to stress a similar drive (and monitor it) to
show what off the shelf SCSI's can do on an internal controller and that
msdb activity just does not come close to the drive capacity. Perhaps SQLIO,
being simpler, would be better.

His DB seems to have a very large number of databases and each of these DB's
seem to have a lot of SQL Agent jobs that fire frequently. This combined
with heavy Message Broker activity is supposedly generating log writes,
reads and I have no clue what, to produce the "heavy activity" that requires
the SAN - which is RAID 5 BTW.

On Friday, January 01, 2010 3:30 PM
Andrew J. Kelly wrote:

Your best option to begin with is to look at the virtual file stats to seehow
Your best option to begin with is to look at the virtual file stats to see
how much physical I/O msdb is actually doing over a given time period. It
will also tell you how long it is taking to read and write those I/O's and
you can see if it is too long or not. I guess he really does not understand
SAN's very well either because SAN's are notoriously slow for writing small
but frequent I/O's and direct attached drives will often outperform them
hands down. If you are processing lots of Service Broker messages then that
can explain some of the activity. But until you look at the file stats it is
hard to say if it is handling it properly or not.

--

Andrew J. Kelly SQL MVP
Solid Quality Mentors

On Saturday, January 02, 2010 7:53 AM
Jay wrote:

Do you know of a Microsoft whitepaper that talks about SAN's being slow
Do you know of a Microsoft whitepaper that talks about SAN's being slow on
small & frequent writes?

On Saturday, January 02, 2010 9:45 AM
Andrew J. Kelly wrote:

I do not think you will find an MS whitepaper on something like that.
I do not think you will find an MS whitepaper on something like that. For one
there are too many variables and performance depends greatly on
configuration and load type. But there is no question that disk for disk a
SAN will never beat the performance of direct attached storage. The
advantages of the SAN are that it is more flexible and scalable in terms of
number of spindles and such. But the biggest down side is that it is
overrated and usually shared with other heavy loads. You might want to have
a look at these:

http://sqlblogcasts.com/search/SearchResults.aspx?q=san+performance

But do not underestimate the virtual file stats and what that can give you.
It will tell you if you are waiting or not.

--

Andrew J. Kelly SQL MVP
Solid Quality Mentors

On Saturday, January 02, 2010 2:52 PM
Jay wrote:

I will check the link out later, for now, I am looking at:select db_name(mf.
I will check the link out later, for now, I am looking at:

select db_name(mf.database_id) as databaseName, divfs.file_id,
mf.physical_name,
num_of_reads, num_of_bytes_read, io_stall_read_ms, num_of_writes,
num_of_bytes_written, io_stall_write_ms, io_stall,size_on_disk_bytes
from sys.dm_io_virtual_file_stats(null,null) as divfs
inner join sys.master_files as mf
on mf.database_id = divfs.database_id
and mf.file_id = divfs.file_id

While it is clear this is what you are refering to, I would like to be sure
I am reading the output right. Unfortunatly, I am having a little trouble. But
that may be because I only have my home system to look at right now.

On Saturday, January 02, 2010 3:53 PM
Jay wrote:

Just got though some of the links, OH MY!
Just got though some of the links, OH MY!

Just one question, when building a cluster, is there an alternative to a
SAN?

On Sunday, January 03, 2010 1:37 PM
TheSQLGuru wrote:

You need shared disk of some sort for a cluster.
You need shared disk of some sort for a cluster. IIRC HP's MSA series are
certified for this kind of implementation, as are other
'semi-direct-attached' enclosures.

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net

On Sunday, January 03, 2010 1:39 PM
TheSQLGuru wrote:

What I recommend is doing a differential analysis of the io stalls.
What I recommend is doing a differential analysis of the io stalls. They
are cumulative, and thus can mask real problems if those are of an
intermittent nature (which they almost always are).

Put your values in a temp table, waitfor delay 'someperiod', now join
current io stall output to the temp table and do a diff based on the time
spread. gets you actual period-based values which are much more meaningful
because you can run for say 5 or 10 minutes during a period you know to be
high-activity.

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net

On Sunday, January 03, 2010 5:39 PM
Andrew J. Kelly wrote:

As Kevin mentioned for the most part you need a SAN although there are
As Kevin mentioned for the most part you need a SAN although there are some
smaller units that will support 2 node clustering from HP and maybe a few
others. But essentially they act like a SAN vs. direct attached storage.

--

Andrew J. Kelly SQL MVP
Solid Quality Mentors

On Sunday, January 03, 2010 5:41 PM
Andrew J. Kelly wrote:

You need a delta to get anything useful out of it.
You need a delta to get anything useful out of it. Here are some sps that
should get you started.

IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
OBJECT_ID(N'[dbo].[gather_wait_stats_2005]') and OBJECTPROPERTY([object_id],
N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[gather_wait_stats_2005] ;
go
CREATE PROCEDURE [dbo].[gather_wait_stats_2005] (@Clear INT = 0)

AS

SET NOCOUNT ON ;

DECLARE @DT DATETIME ;
SET @DT = GETDATE() ;

IF OBJECT_ID(N'[dbo].[wait_stats]',N'U') IS NULL
CREATE TABLE [dbo].[wait_stats]
([wait_type] nvarchar(60) not null,
[waiting_tasks_count] bigint not null,
[wait_time_ms] bigint not null,
[max_wait_time_ms] bigint not null,
[signal_wait_time_ms] bigint not null,
[capture_time] datetime not null default getdate()) ;

-- If 1 the clear out the wait_stats counters & the table
IF @Clear = 1
BEGIN
DBCC SQLPERF([sys.dm_os_wait_stats],clear) WITH no_infomsgs ;
TRUNCATE TABLE [dbo].[wait_stats] ;
END


INSERT INTO [dbo].[wait_stats] ([wait_type], [waiting_tasks_count],
[wait_time_ms], [max_wait_time_ms], [signal_wait_time_ms], [capture_time]) SELECT [wait_type], [waiting_tasks_count], [wait_time_ms], [max_wait_time_ms], [signal_wait_time_ms], @DT
FROM sys.dm_os_wait_stats ;

GO


IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
OBJECT_ID(N'[dbo].[report_wait_stats_2005]') and OBJECTPROPERTY([object_id],
N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[report_wait_stats_2005] ;
GO
CREATE PROCEDURE [dbo].[report_wait_stats_2005]
(@First_Time DATETIME = NULL
,@Last_Time DATETIME = NULL
,@UseOLEDB INT = 0)
/*
-- Date & time of the last sample to use
-- 0 = Dont include OLEDB waits, 1 = Include OLEDB waits
*/
AS

SET NOCOUNT ON ;

IF OBJECT_ID( N'[dbo].[wait_stats]',N'U') IS NULL
BEGIN
RAISERROR('Error [dbo].[wait_stats] table does not exist', 16, 1) WITH
NOWAIT ;
RETURN ;
END

DECLARE @Total_Wait numeric(20,1), @Total_SignalWait numeric(20,1),
@Total_ResourceWait numeric(20,1)
,@EndTime datetime, @Total_Requests Bigint ;

DECLARE @Waits TABLE ([wait_type] nvarchar(60) not null,
[waiting_tasks_count] bigint not null,
[wait_time_ms] bigint not null,
[max_wait_time_ms] bigint not null,
[signal_wait_time_ms] bigint not null,
[capture_time] datetime not null) ;

-- If no First time was specified then use the First sample
IF @First_Time IS NULL
SET @First_Time = (SELECT MIN([capture_time]) FROM [dbo].[wait_stats]) ;
ELSE
BEGIN
-- If the time was not specified exactly find the closest one
IF NOT EXISTS(SELECT * FROM [dbo].[wait_stats] WHERE [capture_time] =
@First_Time)
BEGIN
DECLARE @FT DATETIME ;
SET @FT = @First_Time ;

SET @First_Time = (SELECT MIN([capture_time]) FROM
[dbo].[wait_stats] WHERE [capture_time] <= @FT) ;
IF @First_Time IS NULL
SET @First_Time = (SELECT MIN([capture_time]) FROM
[dbo].[wait_stats] WHERE [capture_time] >= @FT) ;
END
END

-- If no Last time was specified then use the latest sample
IF @Last_Time IS NULL
SET @Last_Time = (SELECT MAX([capture_time]) FROM [dbo].[wait_stats]) ;
ELSE

On Sunday, January 03, 2010 8:31 PM
Jay wrote:

How do you tell which have the slower transfer rates? Reviews?
How do you tell which have the slower transfer rates? Reviews?

On Sunday, January 03, 2010 10:47 PM
Andrew J. Kelly wrote:

You can look at the vendors specs but the bottom line is the actualthroughput
You can look at the vendors specs but the bottom line is the actual
throughput depends mainly on configuration and total load.

--

Andrew J. Kelly SQL MVP
Solid Quality Mentors

On Monday, January 04, 2010 5:22 PM
TheSQLGuru wrote:

Did you mean to paste in the waitstats analysis code Andy?
Did you mean to paste in the waitstats analysis code Andy? :-)

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net

On Monday, January 04, 2010 5:23 PM
TheSQLGuru wrote:

I think it is time to recommend you get a perf tuning professional onboardto
I think it is time to recommend you get a perf tuning professional onboard
to help out. There are a kajillion ways you can screw up an IO subsystem,
and it is a darn shame that almost everyone out there does most of the
things wrong.

--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net

On Tuesday, January 05, 2010 11:28 AM
Andrew J. Kelly wrote:

Sorry thanks for pointing that out Kevin.
Sorry thanks for pointing that out Kevin. While wait stats are good too here
is what I meant to post:

IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
OBJECT_ID(N'[dbo].[gather_file_stats_2005]') AND OBJECTPROPERTY([object_id],
N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[gather_file_stats_2005] ;
go
CREATE PROCEDURE [dbo].[gather_file_stats_2005] (@Clear INT = 0)

AS

SET NOCOUNT ON ;

DECLARE @DT DATETIME ;
SET @DT = GETDATE() ;

IF OBJECT_ID(N'[dbo].[file_stats]',N'U') IS NULL
CREATE TABLE [dbo].[file_stats](
[database_id] [smallint] NOT NULL,
[file_id] [smallint] NOT NULL,
[num_of_reads] [bigint] NOT NULL,
[num_of_bytes_read] [bigint] NOT NULL,
[io_stall_read_ms] [bigint] NOT NULL,
[num_of_writes] [bigint] NOT NULL,
[num_of_bytes_written] [bigint] NOT NULL,
[io_stall_write_ms] [bigint] NOT NULL,
[io_stall] [bigint] NOT NULL,
[size_on_disk_bytes] [bigint] NOT NULL,
[capture_time] [datetime] NOT NULL
) ;


-- If 1 the clear out the table
IF @Clear = 1
BEGIN
TRUNCATE TABLE [dbo].[file_stats] ;
END


INSERT INTO [dbo].[file_stats]
([database_id]
,[file_id]
,[num_of_reads]
,[num_of_bytes_read]
,[io_stall_read_ms]
,[num_of_writes]
,[num_of_bytes_written]
,[io_stall_write_ms]
,[io_stall]
,[size_on_disk_bytes]
,[capture_time])
SELECT [database_id]
,[file_id]
,[num_of_reads]
,[num_of_bytes_read]
,[io_stall_read_ms]
,[num_of_writes]
,[num_of_bytes_written]
,[io_stall_write_ms]
,[io_stall]
,[size_on_disk_bytes]
,@DT
FROM [sys].dm_io_virtual_file_stats(NULL,NULL) ;

GO


IF EXISTS (SELECT * FROM sys.objects WHERE [object_id] =
OBJECT_ID(N'[dbo].[report_file_stats_2005]') and OBJECTPROPERTY([object_id],
N'IsProcedure') = 1)
DROP PROCEDURE [dbo].[report_file_stats_2005] ;
GO
CREATE PROCEDURE [dbo].[report_file_stats_2005]
( @EndTime DATETIME = NULL
, @BeginTime DATETIME = NULL )
-- Date & time of the last sample to use

AS

SET NOCOUNT ON ;

IF OBJECT_ID( N'[dbo].[file_stats]',N'U') IS NULL
BEGIN
RAISERROR('Error [dbo].[file_stats] table does not exist', 16, 1) WITH
NOWAIT ;
RETURN ;
END

DECLARE @file_stats TABLE (
[database_id] [smallint] NOT NULL,
[file_id] [smallint] NOT NULL,
[num_of_reads] [bigint] NOT NULL,
[num_of_bytes_read] [bigint] NOT NULL,
[io_stall_read_ms] [bigint] NOT NULL,
[num_of_writes] [bigint] NOT NULL,
[num_of_bytes_written] [bigint] NOT NULL,
[io_stall_write_ms] [bigint] NOT NULL,
[io_stall] [bigint] NOT NULL,
[size_on_disk_bytes] [bigint] NOT NULL,


Submitted via EggHeadCafe - Software Developer Portal of Choice
Win a Free License of SandRibbon for Silverlight
http://www.eggheadcafe.com/tutorials/aspnet/cb3912a1-be37-4032-a71a-59...e18c0d7
 >> Stay informed about: disk I/O tool 
Back to top
Login to vote
Erland Sommarskog2

External


Since: May 30, 2004
Posts: 2061



(Msg. 25) Posted: Tue Jul 13, 2010 5:25 am
Post subject: Re: Negative results [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

(Gary Rumble) writes:
> I'm using the file stat query from the previous post (I found it in an
> article that I can't locate).
>
> I'm getting negative numbers in several of my result columns.
>
> E.g.
>
> Number of reads: 10
> MBs read: 0.11
> IoStallReadMS: -1301
> ...
> IoStallMS: -959
>
> File Name: Scrabble_log.ldf
>
> Does this make sense?

We don't know exactly what you do, but normally, I think the only situation
you would see negative numbers is if you restart SQL Server in between.

--
Erland Sommarskog, SQL Server MVP, esquel DeleteThis @sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
 >> Stay informed about: disk I/O tool 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
calculating disk IO - How does one calculate disk IO requirements for SQL queries? Then how do I measure what is being produced by my disk subsystem? Thanks for the info. Jason

Disk recomendations - This is probably a basic question but here goes. I am setting up a MS 2000 sql server on a Windows 2003 server attached to a SAN. I am anticipating that the database will be around 50 gig with the SAN allocating around 100 gig for the database drive. My...

%Disk Time - Dear All, I am doing a performance analysis for one of my customer. After analysis of the perfmon logs I foundout average _Total %DiskTime is around 140, when I did a details analysis I found the data drive %DiskTime is 90% of the _Total %DiskTime. Now...

Monitoring disk space - I am trying to write a script to properly monitor disk space for MSSQL server. Is there a stored procedure that tells me the separate space usage of the database and the log? The procedure sp_spaceusage seems to give an "overall" figure. Howe...

Slow hard disk? - I have a dual cpu server, windows 2000, 4G memory, RAID 5 hard disk array The server is very slow, Avg. Disk Bytes/Read 47xxx\.xxx Avg. Disk Read Queue Length 78.xxx Avg. Disk sec/Read 1.7xx Disk Read Bytes/sec 2M Disk Reads/sec 25.xxx SQL Server Active...
   Database Help (Home) -> Server All times are: Pacific Time (US & Canada)
Goto page Previous  1, 2
Page 2 of 2

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]