Variation in performance when using GetDirectories
I have a production performance issue that I'm stumped on. I'm hoping that someone has seen something similar or at least has a few troubleshooting techniques.
I support an inherited asp.net web applicati开发者_C百科on that retrieves files from a shared network drive. One particular folder [we'll call it FOLDERA] I've chosen to troubleshoot against contains about 300mb of files and multiple subfolders. FOLDERA is considered large for this application. Starting recently, the users have been having slow performance when retrieving files from FOLDERA on a production network share. I narrowed the code down to the GetDirectories method within the asp.net application.
RootDir.GetDirectories("*", SearchOption.AllDirectories);
In production, the FOLDERA read takes about 8-10 seconds. Prior to the recent performance degradation it was about 1 second. In the test environment it takes 1-2 seconds with the same amount of data.
My theory is a network issue because the same weekend that the users noticed problems was the same weekend network and hardware upgrades occurred. However, I don't know how to determine or prove this to the network engineers.
I would appreciate ideas on what might be going on.
I have used the same exact method on a large shared directory to extract and index several thousands of pdf files (~80000, size didn't matter) with no performance issues (1-2 seconds)
You could try to benchmark IO from file share between development and production environments with a external program to prove your theory, eliminating any software defect and passing issue to the infrastructure staff.
On the other side you could easily cache this information with CacheDependency on server side, depending on application architecture. This would drastically optimize the performance if this is a core functionality.
精彩评论