<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx</link><description>So, Jason Massie ( http://twitter.com/statisticsio ) had a blog post ( http://statisticsio.com/Home/tabid/36/articleType/ArticleView/articleId/324/Is-8020-a-90rsquos-Estimate.aspx ) that Kendal Van Dyke ( http://twitter.com/sqldba ) alerted me to at SQL</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14799</link><pubDate>Sun, 21 Jun 2009 01:39:18 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14799</guid><dc:creator>jchang</dc:creator><description>&lt;p&gt;the read/write ratio should only apply to data, on the assumption we are interested in RAID5 vs 10 impact.&lt;/p&gt;
&lt;p&gt;Log writes are sequential so RAID 5 is actually better, assuming logs are on its own disk.&lt;/p&gt;
&lt;p&gt;Also, the problem with using dm_io_virtual_file_stats is that it is hard to exclude backups, &lt;/p&gt;
&lt;p&gt;a perfmon log is better, or take a differential reading for business hours&lt;/p&gt;
</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14804</link><pubDate>Sun, 21 Jun 2009 19:23:41 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14804</guid><dc:creator>drsql</dc:creator><description>&lt;p&gt;Definite thanks for the comment. &amp;nbsp;Backups are not something I had really thought about with this DMV.&lt;/p&gt;
&lt;p&gt;Definitely an extremely valid point. In the book I am careful to make note on most DMV's that since they restart only at reboot that you need to be careful to take readings at various points of time and correlate them to processes that might elevate the counts for various reasons, backups being one of them.&lt;/p&gt;
&lt;p&gt;I do feel it is interesting to see the difference between the two values because it can show that 1 read operation can require a gigabyte of data from the physical disk, which can have horrible effects to you performance.&lt;/p&gt;
&lt;p&gt;Plus, if you are doing backups during actual business hours, it could be interesting in any case.&lt;/p&gt;
&lt;p&gt;I have been one in all of my writing/speaking/quacking that I am NOT a hardware expert and I refuse to even try to keep up with how much things change. Being able to interrogate the system to get a feel for what the system is doing in any rate is certainly a good thing.&lt;/p&gt;
</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14805</link><pubDate>Sun, 21 Jun 2009 22:46:20 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14805</guid><dc:creator>Linchi Shea</dc:creator><description>&lt;p&gt;&amp;gt; Log writes are sequential so RAID 5 is actually better, assuming logs are on its own disk.&lt;/p&gt;
&lt;p&gt;Can you expand on this, Joe?&lt;/p&gt;</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14807</link><pubDate>Mon, 22 Jun 2009 00:33:53 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14807</guid><dc:creator>jchang</dc:creator><description>&lt;p&gt;1. my recollection is that the maxtransfersize limit in the backup command is 4M, but most people never change the default of 1M.&lt;/p&gt;
&lt;p&gt;2. you could interogate the msdb database for the database backups, I recall there were values for exactly how many bytes were read (a backup must read from disk, even if the db is in memory). now you just need to figure out how long SQL Server has been up, if you know this, let me know, i need it too.&lt;/p&gt;
&lt;p&gt;3. please make the adjustment to your script to exclude logs, just do file_id &amp;lt;&amp;gt; 2, and not worry about the people with multiple log files, or sum the log file separate from data.&lt;/p&gt;
&lt;p&gt;I do not think it should be necessary to be a hardware expert, but it is important to know how to interpret disk numbers. other wise those san guys will tell you their mutli-million dollar san is so wonderful, it must be your problem&lt;/p&gt;
</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14809</link><pubDate>Mon, 22 Jun 2009 01:20:30 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14809</guid><dc:creator>drsql</dc:creator><description>&lt;p&gt;Just to make certain, why do I want to exclude logs? &amp;nbsp;Is this to make the different approaches equivalent? &amp;nbsp;I mean, I will add that to exclude the logs as a parameter, but it seems to me that when you are looking at it from a hardware basis (which is certainly why you would use the sys.dm_io_virtual_file_stats over the index usage stats dmv), I do care about log writes as well. &lt;/p&gt;
&lt;p&gt;If I just want to know the ratio of reads to write actions, excluding the log file would make sense for sure. I will work on changing that in the next day or two. &amp;nbsp;Thanks for the input.&lt;/p&gt;
</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14816</link><pubDate>Mon, 22 Jun 2009 04:44:33 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14816</guid><dc:creator>jchang</dc:creator><description>&lt;p&gt;the reason read/write ratio is important from the storage perspective is the RAID 5 versus RAID 10 overhead. So for small (8KB for example) (kind of) random IO, in RAID 10, a write requires 2 IO, a write to each part of the mirror, while in RAID 5, a write requires reading the original data, reading the original parity, writing the new data, and writing the new parity.&lt;/p&gt;
&lt;p&gt;This is why RAID 10 is strongly preferred for OLTP databases that exhibit lots of random write IO.&lt;/p&gt;
&lt;p&gt;So the read/write ratio is a metric for whether RAID 10 is necessary or is RAID 5 ok.&lt;/p&gt;
&lt;p&gt;However, the above RAID rule does not apply to large block writes. While the log writes are small, because it is sequential, the RAID controller can accumulate a bunch, and write entire stripes.&lt;/p&gt;
&lt;p&gt;So the log writes should be excluded from read/write ratio calculations. Never mind, the log should be on its own disk, hence not part of the data: RAID 5 or 10 discussion.&lt;/p&gt;
&lt;p&gt;Over course, however strong your arguments might be for the data being on RAID 10, the san engineer will probably ignore the silly dba and do as the san vendor taught him, make it all RAID 5. If performance is bad, it must be the apps fault, because the useless metrics he looks at says everything on the san is wonderful. of course 300ms disk latency is not a problem!&lt;/p&gt;
</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14818</link><pubDate>Mon, 22 Jun 2009 05:08:44 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14818</guid><dc:creator>Linchi Shea</dc:creator><description>&lt;p&gt;Joe;&lt;/p&gt;
&lt;p&gt;In my tests, when a workload is log write constrained, log on RAID1 consistently performed better than log on RAID5 regardless of the underlying configuration of the drive.&lt;/p&gt;</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14833</link><pubDate>Mon, 22 Jun 2009 16:12:16 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14833</guid><dc:creator>Linchi Shea</dc:creator><description>&lt;p&gt;&amp;gt; However, the above RAID rule does not apply to large block writes. While the log writes are small, because it is sequential, the RAID controller can accumulate a bunch, and write entire stripes.&lt;/p&gt;
&lt;p&gt;As far as I observed in my tests, log writes on RAID1 (or 10) consitently outperformed log writes on RAID5 by a very significantly margin.&lt;/p&gt;
</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14836</link><pubDate>Mon, 22 Jun 2009 17:32:14 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14836</guid><dc:creator>jchang</dc:creator><description>&lt;p&gt;thanks Linchi, I assume the RAID 5 log on a dedicated set of disks? with dedicated write cache enabled?&lt;/p&gt;
&lt;p&gt;then the &amp;quot;Never mind&amp;quot; part applies, just make it RAID 1 or 10, but it still should be excluded from the data files R5/10 discussion.&lt;/p&gt;
</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14838</link><pubDate>Mon, 22 Jun 2009 18:35:03 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14838</guid><dc:creator>Linchi Shea</dc:creator><description>&lt;p&gt;I have actually run quite many tests on this subject on drives presented from disk arrays of different types and configurations.&lt;/p&gt;
</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14856</link><pubDate>Tue, 23 Jun 2009 12:10:44 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14856</guid><dc:creator>Uri Dimant</dc:creator><description>&lt;p&gt;Louis/Joe/&lt;/p&gt;
&lt;p&gt;Can you clarify, should the below two queries return the same (almost) databases for to writes ( I know the second one does have a log files included , but even If I do include the Logs in the first one I get very very different results)&lt;/p&gt;
&lt;p&gt;WITH cte&lt;/p&gt;
&lt;p&gt;AS&lt;/p&gt;
&lt;p&gt;(&lt;/p&gt;
&lt;p&gt;SELECT&lt;/p&gt;
&lt;p&gt; &amp;nbsp; DB_NAME(IVFS.database_id) AS db,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; CASE WHEN MF.type = 1 THEN 'log' ELSE 'data' END AS file_type,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; SUM(IVFS.num_of_bytes_read)as reads,&lt;/p&gt;
&lt;p&gt; &amp;nbsp;SUM(IVFS.num_of_bytes_written) AS writes,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; SUM(IVFS.io_stall) AS io_stall&lt;/p&gt;
&lt;p&gt; FROM sys.dm_io_virtual_file_stats(NULL, NULL) AS IVFS&lt;/p&gt;
&lt;p&gt; &amp;nbsp; JOIN sys.master_files AS MF&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; ON IVFS.database_id = MF.database_id&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; AND IVFS.file_id = MF.file_id&lt;/p&gt;
&lt;p&gt; GROUP BY DB_NAME(IVFS.database_id), MF.type&lt;/p&gt;
&lt;p&gt;) SELECT * FROM cte WHERE file_type='data'&lt;/p&gt;
&lt;p&gt;ORDER BY writes DESC&lt;/p&gt;
&lt;p&gt;SELECT &lt;/p&gt;
&lt;p&gt;sd.name As DatabaseName,&lt;/p&gt;
&lt;p&gt;CAST(SUM(user_seeks+user_scans+user_lookups) AS decimal) / &lt;/p&gt;
&lt;p&gt;CAST(SUM(user_updates) + SUM(user_seeks+user_scans+user_lookups) AS decimal) &lt;/p&gt;
&lt;p&gt;* 100 AS ReadPercent,&lt;/p&gt;
&lt;p&gt;CAST(SUM(user_updates) AS decimal) / &lt;/p&gt;
&lt;p&gt;CAST(SUM(user_updates) + SUM(user_seeks + user_scans + user_lookups) AS decimal) &lt;/p&gt;
&lt;p&gt;* 100 AS WriteRatio&lt;/p&gt;
&lt;p&gt;FROM sys.dm_db_index_usage_stats dbius&lt;/p&gt;
&lt;p&gt;Join sys.databases sd&lt;/p&gt;
&lt;p&gt;On (sd.database_id = dbius.database_id)&lt;/p&gt;
&lt;p&gt;Group By sd.name&lt;/p&gt;
&lt;p&gt;Order By WriteRatio &amp;nbsp;DESC&lt;/p&gt;
</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14880</link><pubDate>Tue, 23 Jun 2009 19:55:19 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14880</guid><dc:creator>RowlandG</dc:creator><description>&lt;p&gt;File IO Measured.&lt;/p&gt;
&lt;p&gt;Data exceeds what SAN delivers.&lt;/p&gt;
&lt;p&gt;Must use DAS.&lt;/p&gt;
</description></item><item><title>re: Read/Write Ratio versus Read/Write Ratio?</title><link>http://sqlblog.com/blogs/louis_davidson/archive/2009/06/20/read-write-ratio-versus-read-write-ratio.aspx#14907</link><pubDate>Thu, 25 Jun 2009 02:44:15 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:14907</guid><dc:creator>drsql</dc:creator><description>&lt;p&gt;Uri, this is a very good point. I think what we are looking at are two different things altogether. &amp;nbsp;The sys.dm_io_virtual_file_stats view measures writes to the file. &amp;nbsp;My assumption is that this would technically count the number of operations where the lazy writer pushed out changes to the file, even if it was just status of a row (like to mark the page as dirty). &amp;nbsp;It wouldn't be any specific operation that caused it to occur, other than either idle time or needing to free up cache space.&lt;/p&gt;
&lt;p&gt;On the other hand sys.dm_db_index_usage_stats might not actually require that the file was written to yet (the log would have been written to) but that the table was changed. A read wouldn't necessarily be a read to the file, but it could simply be from cache.&lt;/p&gt;
&lt;p&gt;Hmm, I think that again I have to rethink a bit about this topic, and check my text to make sure I am not claiming that the different queries are comparing apples to oranges.&lt;/p&gt;
</description></item></channel></rss>