次の方法で共有


SQL Server on Linux: Scatter/Gather == Vectored I/O

Scatter/gather capabilities allow more efficient memory to disk transfers reducing redundant memory copies, sorting and other activities applications may require to gain improved I/O performance.

If my memory serves me correctly SQL Server started using the ReadFileScatter and WriteFileGather APIs in SQL Server 6.5 SP3.  It may not have been this exact build but as the running joke around here goes “That information was saved to my offsite backup!”

Scatter/gather is not limited to the Windows platform.  On Linux the capabilities are called “Vectored I/O.” – Example writev  SQL Server on Linux takes full advantage of vectored I/O, retaining the performance and design benefits.

On Linux there is one small twist.  The Windows the API set does not impose a specific limit on the number of buffers (read/write) size for a request.  On Linux the total number of buffers that can be read or written, in a single ABI request, is capped at 2048.   The buffers must be the operating system page size (4K.)   There are a few locations (zero file, column store, …) in SQL Server which attempt to read or write more then 1024 database pages in a single request.  (Remember SQL Server database pages are 8K, taking up 2 positions in the read or write request.)

Within LibOS, when we detect a request exceeding 2048 OS pages, we split the request into multiple 2048 page chunks, deemed sub-I/O requests.  The logic attempts to retain as few I/O requests as possible using vectored I/O for each of the sub request and maximizing I/O performance.  Once all sub-I/O requests, for the original parent request, are complete the original I/O request is considered complete maintaining application compatibility.

image

 

Bob Dorr – Principal Software Engineer SQL Server