Sequential File Programming Patterns and Performance with .NET

MSR-TR-2004-136 |

Published by Microsoft

View Publication

Programming patterns for sequential file access in the .NET Framework are described and the performance is measured. The default behavior provides excellent performance on a single disk – 50 MBps both reading and writing. Using large request sizes and doing file pre-allocation when possible have quantifiable benefits. When one considers disk arrays, .NET unbuffered IO delivers 800 MBps on a 16-disk array, but buffered IO delivers about 12% of that performance. Consequently, high-performance file and database utilities are still forced to use unbuffered IO for maximum sequential performance. The report is accompanied by downloadable source code that demonstrates the concepts and code that was used to obtain these measurements.

Publication Downloads

Sequential File Programming in .Net

December 28, 2004

This code is a companion to the paper "Sequential File Programming Patterns and Performance with .NET" by Peter Kukol and Jim Gray, MSR-TR-2004-136. It contains 4 projects. (1) IOexamples shows the simple design patterns for doing sequential file access in .NET. (2) AsyncIO shows how to do unbuffered AsyncIO in .NET (3) FragDisk is a utility that creates many files on a volume and so leaves it fragmented. (4) IOspeed is a utility used to measure the speed of file access from a disk. It was used to generate the performance numbers in the technical report. All the code is in C# and uses VisualStudio2005 and the .NET 1.8 runtime.

Download Data