Runtime: Developers using FileStream find it to be high performance and robust

Created on 5 Aug 2020  ·  7Comments  ·  Source: dotnet/runtime

(Note .CopyToAsync is pretty good; for certain combinations of flags)

Issues:

  • [ ] Read{Async} and Write{Async} etc call SeekCore which on Windows calls the blocking api SetFilePointerEx which the "Windows Server Performance Team Blog: Designing Applications for High Performance – Part III" (June 25, 2008) says about
    > The old DOS SetFilePointer API is an anachronism. One should specify the file offset in the overlapped structure even for synchronous I/O.
  • [ ] Avoid unnecessary allocations when using FileStream #15088
  • [ ] Win32 FileStream turns async reads into sync reads #16341
  • [ ] Win32 FileStream will issue a seek on every ReadAsync call #16354
  • [ ] FileStream.FlushAsync ends up doing synchronous writes #27643
  • [ ] Asynchronous random file access with FileStream Read vs ReadAsync in a loop / parallel (ReadAsync is slow) #27047
  • [ ] FileStream.Windows useAsync WriteAsync calls blocking apis #25905
  • [ ] File.ReadAllTextAsync not behaving asynchronously when called on inaccessible network files #25314
  • [ ] Use PreallocatedOverlapped when internal FileStream buffer isn't being used on Windows #25074
  • [ ] File.WriteAllTextAsync performance issues #23196
  • [ ] Asynchronous FileStream I/O can throw in the completion port callback thread #13658
  • [ ] Rosyln has their own workarounds for FileStream issues; and NuGet recently moved to mmap for better performance https://github.com/NuGet/NuGet.Client/pull/3524

_Edit by carlossanlop: To focus on the Async/Sync improvements, I'm removing 3 issues from the list that are separate from that topic._

Bottom Up Work User Story area-System.IO tenet-performance

Most helpful comment

Changed title to "user story terms" even though it's clearly not describing the current state.

All 7 comments

Thanks for collecting these into an “epic” 🙂 This is a candidate for some code debt work before 6.0 feature work starts.

@JeremyKuhne you've been a vocal advocate of improving FileStream in the past. Is there anything you want to add to this meta-issue?

Thank you @benadams for compiling the list.

May I suggest to focus this epic specifically for improving sync/async in FileStream, which seems to be the main topic of most of those issues? If agreed, then these issues can be removed from the epic and addressed separately:

@stephentoub What do you think about #8307, #29173, and #28444 -- do you think those are standalone enough to treat separately from the bigger collection of issues? If so, we can go ahead and get started on those soon.

do you think those are standalone enough to treat separately from the bigger collection of issues?

Yes

Changed title to "user story terms" even though it's clearly not describing the current state.

Was this page helpful?
0 / 5 - 0 ratings