{"id":1022,"date":"2008-08-25T22:53:31","date_gmt":"2008-08-25T22:53:31","guid":{"rendered":"\/blogs\/paul\/post\/High-performance-FILESTREAM-tips-and-tricks.aspx"},"modified":"2013-01-01T23:56:20","modified_gmt":"2013-01-02T07:56:20","slug":"high-performance-filestream-tips-and-tricks","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/high-performance-filestream-tips-and-tricks\/","title":{"rendered":"High-performance FILESTREAM tips and tricks"},"content":{"rendered":"<p><FONT face=Verdana size=2><br \/>\n<P>Over the last few weeks I&#8217;ve had lots of questions about FILESTREAM performance and how to coax NTFS into scaling nicely. I just finished writing a 30-page whitepaper about FILESTREAM for the SQL Server team, which should be published before PASS in November (I&#8217;ll blog the link when I have it). Although my whitepaper isn&#8217;t strictly about performance, there is a long section about setting up your system to get high-performance from FILESTREAM. What I want to do in this blog post is give a bullet list of things to do that will help you get good performance. All of these are explained in more detail in the whitepaper.<\/P><br \/>\n<P>Here you go, in no particular order:<\/P><br \/>\n<UL><br \/>\n<LI>Make sure you&#8217;re storing the right-sized data in the right way. Jim Gray (et al) published a research paper a couple of years ago based called <a href=\"http:\/\/research.microsoft.com\/apps\/pubs\/default.aspx?id=64525\"><EM>To BLOB or Not To BLOB: Large Object Storage in a Database or a Filesystem?<\/EM><\/a>. To summarize the findings, BLOBs smaller than 256-KB should be stored in a database, and 1-MB or larger should be stored in the file-system. For those in-between, &#8220;it depends&#8221; &#8211; my favorite answer. The upshot of this is that you won&#8217;t get good performance if you store lots of small BLOBs in FILESTREAM.<br \/>\n<LI>Use an appropriate RAID level for the NTFS volume that will host the FILESTREAM data container (the NTFS directory structure corresponding to the FILESTREAM filegroup in the database). Don&#8217;t use RAID-5, for instance, for a write-intensive workload.<br \/>\n<LI>Use an appropriate disk technology. SCSI will be usually be faster than SATA\/IDE, but more expensive. This is because SCSI drives usually have higher rotational speeds, so lower latency and seek times.<br \/>\n<LI>Whichever disk technology you choose, if SATA, ensure it supports NCQ, and if SCSI, ensure it supports CTQ. Both of these allow the drives to process multiple, interleaved IOs concurrently.<br \/>\n<LI>Separate the data containers. Separate them from each other, and separate them from other database data and log files. This avoids contention for the disk heads.<br \/>\n<LI>Defrag the NTFS volume if needed before setting up FILESTREAM, and periodically to maintain good scan performance<br \/>\n<LI>Turn off 8.3 name generation on the NTFS volume. This is an order-N algorithm that has to check that the new name generated doesn&#8217;t collide with any existing names in the directory. This slows insert and update performance down *a lot*. Do this using the command line <STRONG>fsutil<\/STRONG> utility.<br \/>\n<LI>Turn off tracking of last access time using fsutil.<br \/>\n<LI>Set the NTFS cluster size appropriately. For BLOBs 1-MB or large, use a cluster size of 64-KB. This will help to reduce fragmentation.<br \/>\n<LI>A partial update of FILESTREAM data creates a new file. Batch lots of small updates into one large update to reduce churn.<br \/>\n<LI>When streaming the data back to the client, use an ~60-KB SMB buffer size (or multiples thereof). This is so that the buffers don&#8217;t get overly fragmented as TCP\/IP buffer are 64-KB.<\/LI><\/UL><br \/>\n<P>Hope this helps!<\/P><\/FONT><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over the last few weeks I&#8217;ve had lots of questions about FILESTREAM performance and how to coax NTFS into scaling nicely. I just finished writing a 30-page whitepaper about FILESTREAM for the SQL Server team, which should be published before PASS in November (I&#8217;ll blog the link when I have it). Although my whitepaper isn&#8217;t [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41,66,86],"tags":[],"class_list":["post-1022","post","type-post","status-publish","format-standard","hentry","category-filestream","category-performance-tuning","category-sql-server-2008"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>High-performance FILESTREAM tips and tricks - Paul S. Randal<\/title>\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\/high-performance-filestream-tips-and-tricks\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"High-performance FILESTREAM tips and tricks - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"Over the last few weeks I&#8217;ve had lots of questions about FILESTREAM performance and how to coax NTFS into scaling nicely. I just finished writing a 30-page whitepaper about FILESTREAM for the SQL Server team, which should be published before PASS in November (I&#8217;ll blog the link when I have it). Although my whitepaper isn&#8217;t [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/high-performance-filestream-tips-and-tricks\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2008-08-25T22:53:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-02T07:56:20+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\/high-performance-filestream-tips-and-tricks\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/high-performance-filestream-tips-and-tricks\/\",\"name\":\"High-performance FILESTREAM tips and tricks - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2008-08-25T22:53:31+00:00\",\"dateModified\":\"2013-01-02T07:56:20+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/high-performance-filestream-tips-and-tricks\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/high-performance-filestream-tips-and-tricks\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/high-performance-filestream-tips-and-tricks\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"High-performance FILESTREAM tips and tricks\"}]},{\"@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":"High-performance FILESTREAM tips and tricks - Paul S. Randal","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\/high-performance-filestream-tips-and-tricks\/","og_locale":"en_US","og_type":"article","og_title":"High-performance FILESTREAM tips and tricks - Paul S. Randal","og_description":"Over the last few weeks I&#8217;ve had lots of questions about FILESTREAM performance and how to coax NTFS into scaling nicely. I just finished writing a 30-page whitepaper about FILESTREAM for the SQL Server team, which should be published before PASS in November (I&#8217;ll blog the link when I have it). Although my whitepaper isn&#8217;t [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/high-performance-filestream-tips-and-tricks\/","og_site_name":"Paul S. Randal","article_published_time":"2008-08-25T22:53:31+00:00","article_modified_time":"2013-01-02T07:56:20+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\/high-performance-filestream-tips-and-tricks\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/high-performance-filestream-tips-and-tricks\/","name":"High-performance FILESTREAM tips and tricks - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2008-08-25T22:53:31+00:00","dateModified":"2013-01-02T07:56:20+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/high-performance-filestream-tips-and-tricks\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/high-performance-filestream-tips-and-tricks\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/high-performance-filestream-tips-and-tricks\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"High-performance FILESTREAM tips and tricks"}]},{"@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\/1022","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=1022"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/1022\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=1022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=1022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=1022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}