SQL 2016 - It Just Runs Faster: Larger Data File Writes

Published Jan 15 2019 04:58 PM 149 Views
Microsoft
First published on MSDN on Apr 15, 2016

SQL Server uses WriteFileGather for the vast majority of data file write requests.   The logic is to consolidate dirty pages into a single I/O request.

For example page 1:13 and 1:12 are dirty resulting in a single WriteFileGather operation.

Is BUF[1] Dirty - Yes - Write with gather near


Do hash lookups until we have 32 pages (SQL Server 2012 and 2014) or no more dirty pages to create a contiguous block.

Is Page 1:14 in memory (hashed) and dirty NO - End forward search for near pages

Is Page 1:12 in memory (hashed) and dirty YES - Include in write request

Is Page 1:11 in memory (hashed) and dirty NO - End of backward search for near pages

Write pages 1:12 and 1:13 in a single (WriteFileGather) block

For over a decade hardware performed best with at 64 or 128K requests.  The newer SSD and flash implementations often have 1MB to 4MB internal blocking sizes.   Increasing the overall size of data file writes slim lines the (R)ead (M)odify (W)rite behavior, increasing scalability and performance.

SQL Server 2016 ( X64 installations ) increase the number of contiguous, 8K pages from 32 to 128 (1MB) when performing (Lazy, checkpoint, select into, create index and bulk insert write operations.)   These write operations encompass 95%+ of the write operations for data file.

'It Just Runs Faster' - SQL Server 2016 takes advantage of newer hardware scalability by increasing the database file write operations.

Bob Dorr - Principal SQL Server Software Engineer

%3CLINGO-SUB%20id%3D%22lingo-sub-318731%22%20slang%3D%22en-US%22%3ESQL%202016%20-%20It%20Just%20Runs%20Faster%3A%20Larger%20Data%20File%20Writes%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-318731%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20MSDN%20on%20Apr%2015%2C%202016%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%3ESQL%20Server%20uses%20%3CA%3E%20WriteFileGather%20%3C%2FA%3E%20for%20the%20vast%20majority%20of%20data%20file%20write%20requests.%26nbsp%3B%26nbsp%3B%20The%20logic%20is%20to%20consolidate%20dirty%20pages%20into%20a%20single%20I%2FO%20request.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EFor%20example%20page%201%3A13%20and%201%3A12%20are%20dirty%20resulting%20in%20a%20single%20WriteFileGather%20operation.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F68405i8D2882DBE699CAD6%22%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EIs%20BUF%5B1%5D%20Dirty%20-%20Yes%20-%20Write%20with%20gather%20near%3C%2FP%3E%0A%20%20%3CP%3E%3CBR%20%2F%3E%20Do%20hash%20lookups%20until%20we%20have%2032%20pages%20(SQL%20Server%202012%20and%202014)%20or%20no%20more%20dirty%20pages%20to%20create%20a%20contiguous%20block.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EIs%20Page%201%3A14%20in%20memory%20(hashed)%20and%20dirty%20NO%20-%20End%20forward%20search%20for%20near%20pages%3C%2FP%3E%0A%20%20%3CP%3EIs%20Page%201%3A12%20in%20memory%20(hashed)%20and%20dirty%20YES%20-%20Include%20in%20write%20request%3C%2FP%3E%0A%20%20%3CP%3EIs%20Page%201%3A11%20in%20memory%20(hashed)%20and%20dirty%20NO%20-%20End%20of%20backward%20search%20for%20near%20pages%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EWrite%20pages%201%3A12%20and%201%3A13%20in%20a%20single%20(WriteFileGather)%20block%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EFor%20over%20a%20decade%20hardware%20performed%20best%20with%20at%2064%20or%20128K%20requests.%26nbsp%3B%20The%20newer%20SSD%20and%20flash%20implementations%20often%20have%201MB%20to%204MB%20internal%20blocking%20sizes.%26nbsp%3B%26nbsp%3B%20Increasing%20the%20overall%20size%20of%20data%20file%20writes%20slim%20lines%20the%20(R)ead%20(M)odify%20(W)rite%20behavior%2C%20increasing%20scalability%20and%20performance.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3ESQL%20Server%202016%20(%20%3CSTRONG%3E%20X64%20installations%20%3C%2FSTRONG%3E%20)%20increase%20the%20number%20of%20contiguous%2C%208K%20pages%20from%2032%20to%20%3CSTRONG%3E%20128%20%3C%2FSTRONG%3E%20(1MB)%20when%20performing%20(Lazy%2C%20checkpoint%2C%20select%20into%2C%20create%20index%20and%20bulk%20insert%20write%20operations.)%26nbsp%3B%26nbsp%3B%20These%20write%20operations%20encompass%2095%25%2B%20of%20the%20write%20operations%20for%20data%20file.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3E%3CSTRONG%3E'It%20Just%20Runs%20Faster'%20%3C%2FSTRONG%3E%20-%20SQL%20Server%202016%20takes%20advantage%20of%20newer%20hardware%20scalability%20by%20increasing%20the%20database%20file%20write%20operations.%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%20%3CP%3EBob%20Dorr%20-%20Principal%20SQL%20Server%20Software%20Engineer%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-318731%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Apr%2015%2C%202016%20SQL%20Server%20uses%20WriteFileGather%20for%20the%20vast%20majority%20of%20data%20file%20write%20requests.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-318731%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPerformance%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Esql%202016%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Jan 15 2019 04:58 PM
Updated by: