{"id":4990,"date":"2019-05-16T14:15:12","date_gmt":"2019-05-16T21:15:12","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/paul\/?p=4990"},"modified":"2019-05-16T14:20:27","modified_gmt":"2019-05-16T21:20:27","slug":"the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/","title":{"rendered":"The Curious Case of&#8230; does SQL Server use a read\/write thread per LUN?"},"content":{"rendered":"<p style=\"text-align: justify;\"><em>(The Curious Case of\u2026<\/em>\u00a0used to be part of our bi-weekly\u00a0<a href=\"https:\/\/www.sqlskills.com\/join-the-sqlskills-insider-community\/\" target=\"_blank\" rel=\"noopener noreferrer\">newsletter<\/a>\u00a0but we decided to make it a\u00a0regular blog post instead so it can sometimes be more frequent. It covers something interesting one of us encountered when working with a client, doing some testing, or were asked in a random question from the community.)<\/p>\n<p style=\"text-align: justify;\">I had a question in email this morning from someone that was basically does SQL Server use a read\/write thread per LUN?<\/p>\n<p style=\"text-align: justify;\">The short answer is no.<\/p>\n<p style=\"text-align: justify;\">My friend Bob Dorr from CSS actually debunked this publicly way back in\u00a0 2007 in the blog post\u00a0<a href=\"https:\/\/blogs.msdn.microsoft.com\/psssql\/2007\/02\/21\/sql-server-urban-legends-discussed\/\" target=\"_blank\" rel=\"noopener noreferrer\"><em>SQL Server Urban Legends Discussed<\/em><\/a> and also explains how some of the wording in earlier versions of Books online led to the myth that SQL Server uses one read\/write thread per LUN or per data file. This myth leads people to believe that adding more data files will increase I\/O performance because more threads will be used to do the writing. While it&#8217;s true that more data files can increase performance, depending on your I\/O subsystem and the file\/filegroup layout on that I\/O subsystem, it&#8217;s nothing to do with that myth.<\/p>\n<p style=\"text-align: justify;\">Any thread in SQL Server that&#8217;s processing a query can issue an asynchronous read request. When a thread makes a call into the buffer pool to get\u00a0 a pointer to a data file page copy in memory, if the page isn&#8217;t already in memory then it has to issue a read and then wait for the read to complete (called a physical I\/O). On the other hand, if the page already is in memory, the thread pops back out to where it came from (usually the Access Methods code) and that&#8217;s a logical I\/O, with no accompanying wait. Pages can also be read in larger chunks by things like index seek\/scan readahead and <em>DBCC CHECKDB<\/em>&#8216;s readahead.<\/p>\n<p style=\"text-align: justify;\">Pages can be written to disk in a variety of ways, including:<\/p>\n<ul>\n<li style=\"text-align: justify;\">Through a regular checkpoint by a checkpoint background thread<\/li>\n<li style=\"text-align: justify;\">Through lazy writing when there&#8217;s memory pressure on the buffer pool bu a lazy writer background thread<\/li>\n<li style=\"text-align: justify;\">Through eager writing, when performing a minimally-logged operation in (guaranteeing that the full result of the operation is durable when it finishes)<\/li>\n<li style=\"text-align: justify;\">Through database snapshot real-time maintenance, when a page is first changed after a database snapshot is created, it is synchronously written to the snapshot<\/li>\n<\/ul>\n<p>There&#8217;s one exception though: backup and restore *will* use a separate reader or writer thread per device to aid in I\/O parallelism, but backup and restore don&#8217;t use the buffer pool and open direct channels to the devices themselves.<\/p>\n<p>Bottom line: for regular operations, the one-thread-per-file\/LUN is a big myth that&#8217;s still around today.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>(The Curious Case of\u2026\u00a0used to be part of our bi-weekly\u00a0newsletter\u00a0but we decided to make it a\u00a0regular blog post instead so it can sometimes be more frequent. It covers something interesting one of us encountered when working with a client, doing some testing, or were asked in a random question from the community.) I had a [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53,115],"tags":[],"class_list":["post-4990","post","type-post","status-publish","format-standard","hentry","category-io-subsystems","category-the-curious-case-of"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Does SQL Server use a read\/write thread per LUN?<\/title>\n<meta name=\"description\" content=\"The Curious Case of... does SQL Server use a read\/write thread per LUN?\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Does SQL Server use a read\/write thread per LUN?\" \/>\n<meta property=\"og:description\" content=\"The Curious Case of... does SQL Server use a read\/write thread per LUN?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-16T21:15:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-16T21:20:27+00:00\" \/>\n<meta name=\"author\" content=\"Paul Randal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Randal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/\",\"name\":\"Does SQL Server use a read\/write thread per LUN?\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2019-05-16T21:15:12+00:00\",\"dateModified\":\"2019-05-16T21:20:27+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"description\":\"The Curious Case of... does SQL Server use a read\/write thread per LUN?\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Curious Case of&#8230; does SQL Server use a read\/write thread per LUN?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\",\"name\":\"Paul S. Randal\",\"description\":\"In Recovery...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\",\"name\":\"Paul Randal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"caption\":\"Paul Randal\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/paul\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Does SQL Server use a read\/write thread per LUN?","description":"The Curious Case of... does SQL Server use a read\/write thread per LUN?","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/","og_locale":"en_US","og_type":"article","og_title":"Does SQL Server use a read\/write thread per LUN?","og_description":"The Curious Case of... does SQL Server use a read\/write thread per LUN?","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/","og_site_name":"Paul S. Randal","article_published_time":"2019-05-16T21:15:12+00:00","article_modified_time":"2019-05-16T21:20:27+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/","name":"Does SQL Server use a read\/write thread per LUN?","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2019-05-16T21:15:12+00:00","dateModified":"2019-05-16T21:20:27+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"description":"The Curious Case of... does SQL Server use a read\/write thread per LUN?","breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/the-curious-case-of-does-sql-server-use-a-readwrite-thread-per-lun\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"The Curious Case of&#8230; does SQL Server use a read\/write thread per LUN?"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/","name":"Paul S. Randal","description":"In Recovery...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce","name":"Paul Randal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","caption":"Paul Randal"},"sameAs":["http:\/\/3.209.169.194\/blogs\/paul"],"url":"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/4990","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/comments?post=4990"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/4990\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=4990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=4990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=4990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}