{"id":4969,"date":"2019-02-27T12:46:46","date_gmt":"2019-02-27T20:46:46","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/paul\/?p=4969"},"modified":"2019-03-12T17:01:28","modified_gmt":"2019-03-13T00:01:28","slug":"preemptive_os_flushfilebuffers-waits-on-linux","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/","title":{"rendered":"PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux"},"content":{"rendered":"<p style=\"text-align: justify;\">Last week I blogged about <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/using-the-wait-statistics-report-in-azure-data-studio\/\" target=\"_blank\" rel=\"noopener noreferrer\">Using the Wait Statistics Report in Azure Data Studio<\/a>, using a Linux VM in Azure as an example host. As that was my first time running wait stats analysis on a Linux host, I found that the <a href=\"https:\/\/www.sqlskills.com\/help\/waits\/preemptive_os_flushfilebuffers\/\" target=\"_blank\" rel=\"noopener noreferrer\"><em>PREEMPTIVE_OS_FLUSHFILEBUFFERS<\/em><\/a> waits on Linux will show up as the top wait on SQL Server 2017 CU6 and higher with default options.<\/p>\n<p style=\"text-align: justify;\">The simple reason for this is that on some Linux servers where the underling I\/O subsystem cannot guarantee durable writes when the power fails (i.e. it&#8217;s using a volatile write cache), a power failure could lead to data loss within SQL Server. To work around this, 2017 CU6 introduced forced-flush behavior for log and data writing, including things like backups and writes to <em>FILESTREAM<\/em> files. This means that the writes will be done as normal, and then a call is made to the Windows <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/desktop\/api\/fileapi\/nf-fileapi-flushfilebuffers\" target=\"_blank\" rel=\"noopener noreferrer\"><em>FlushFileBuffers<\/em><\/a> function, which is translated via the SQLPAL\/HostExtension wrapper on Linux into an <a href=\"https:\/\/www.unix.com\/man-page\/redhat\/2\/fdatasync\/\" target=\"_blank\" rel=\"noopener noreferrer\"><em>fdatasync<\/em><\/a> call. There&#8217;s a very deep explanation of all the file system internals in Bob Dorr&#8217;s excellent post <a href=\"https:\/\/blogs.msdn.microsoft.com\/bobsql\/2018\/12\/18\/sql-server-on-linux-forced-unit-access-fua-internals\/\" target=\"_blank\" rel=\"noopener noreferrer\">SQL Server On Linux: Forced Unit Access (Fua) Internals<\/a>.<\/p>\n<p style=\"text-align: justify;\">If you know your I\/O subsystem is resilient, you can disable this behavior, as described in <a href=\"https:\/\/support.microsoft.com\/en-us\/help\/4131496\/enable-forced-flush-mechanism-in-sql-server-2017-on-linux\" target=\"_blank\" rel=\"noopener noreferrer\">KB 4131496<\/a>.<\/p>\n<p style=\"text-align: justify;\">However, as this will be by far the highest wait on many Linux systems, and as it&#8217;s benign, I&#8217;ve added it to the <a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/wait-statistics-or-please-tell-me-where-it-hurts\/\" target=\"_blank\" rel=\"noopener noreferrer\">list of waits I ignore<\/a> and updated the Server Reports extension for Azure Data Studio to filter it out as well (this is now live as v1.4).<\/p>\n<p style=\"text-align: justify;\">Enjoy!<\/p>\n<p style=\"text-align: justify;\">PS I also just added the <a href=\"https:\/\/www.sqlskills.com\/help\/waits\/vdi_client_other\/\" target=\"_blank\" rel=\"noopener noreferrer\"><em>VDI_CLIENT_OTHER<\/em><\/a> wait to the ignore list as well (common from Availability Group seeding), and submitted GitHub changes to Server Reports yesterday, which will be v1.5.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week I blogged about Using the Wait Statistics Report in Azure Data Studio, using a Linux VM in Azure as an example host. As that was my first time running wait stats analysis on a Linux host, I found that the PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux will show up as the top wait on SQL [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[114,112,101],"tags":[],"class_list":["post-4969","post","type-post","status-publish","format-standard","hentry","category-azure-data-studio","category-linux","category-wait-stats"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux<\/title>\n<meta name=\"description\" content=\"Why are there so many PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux?\" \/>\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\/preemptive_os_flushfilebuffers-waits-on-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux\" \/>\n<meta property=\"og:description\" content=\"Why are there so many PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-27T20:46:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-13T00:01:28+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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/\",\"name\":\"PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2019-02-27T20:46:46+00:00\",\"dateModified\":\"2019-03-13T00:01:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"description\":\"Why are there so many PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux?\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux\"}]},{\"@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":"PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux","description":"Why are there so many PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux?","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\/preemptive_os_flushfilebuffers-waits-on-linux\/","og_locale":"en_US","og_type":"article","og_title":"PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux","og_description":"Why are there so many PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux?","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/","og_site_name":"Paul S. Randal","article_published_time":"2019-02-27T20:46:46+00:00","article_modified_time":"2019-03-13T00:01:28+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/","name":"PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2019-02-27T20:46:46+00:00","dateModified":"2019-03-13T00:01:28+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"description":"Why are there so many PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux?","breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/preemptive_os_flushfilebuffers-waits-on-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"PREEMPTIVE_OS_FLUSHFILEBUFFERS waits on Linux"}]},{"@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\/4969","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=4969"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/4969\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=4969"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=4969"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=4969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}