How to handle large numbers of concurrent disk write requests as efficiently as possible
问题 Say the method below is being called several thousand times by different threads in a .net 4 application. What’s the best way to handle this situation? Understand that the disk is the bottleneck here but I’d like the WriteFile() method to return quickly. Data can be can be up to a few MB. Are we talking threadpool, TPL or the like? public void WriteFile(string FileName, MemoryStream Data) { try { using (FileStream DiskFile = File.OpenWrite(FileName)) { Data.WriteTo(DiskFile); DiskFile.Flush()