context menu - local app runs slow modifying file on unc drive

I have a small util that I use to "freeze" files on a fileserver, it re-arranges the bytes so that it can't be loaded /edited using Excel or Autocad, and will put them back in place when needed.



I have set this up for fast access .. right clicking a file and choosing to run that util from the context menu on the chosen file. Additionally, a star wrapped TCL script is actually called first, as it will display TK popup warnings of overwrites, and then call the main util to do the scrambling unless aborted. Both the scrambling util and the TCL wrap that calls it reside on local computer in the path.



I have drive mapped the fileserver, but several people who also use this util simply have a shortcut to the unc address of the fileserver, and we've noticed that, if the util is run against any file on the local computer or on a mapped drive, it run instantly, but if it's run against a file on a unc path, the util will think about things for about ten seconds before doing it's thing.



Additionally, I've done some testing that produces odd results:



* If I modify the context menu to run only the scrambling util and not the overwrite checker that calls the scrambling util. it will run instantly on files on a unc path.



- however -



* If I run the overwrite checker (that will call the main util) from a cmd window with a unc path file as the argument, (as what happens in the context menu) it will also run instantly.



So, only when run from the context menu will this exhibit the roughly ten second pause. Moreover, I have another entry in the context menu that calls on a custom compression util, that uses the _exact same_ TCL overwrite checker, and that util will run without pause on unc drive files. The only difference being that with the scrambling util, the TCL overwrite checker will call the scrambling util which is compiled D code, and the with the compression util, it calls on Ruby to run a short script.



Any help in solving this mystery would be appreciated, thanks,

|
Answer
Answer

Hello,

When accessing a file server through the SMB protocol, especially when the folder contains a large number of small files, performance degradation may indeed occur, especially when performing directory traversal or search operations, a large number of files similar to SMB2_FIND_ID_BOTH_DIRECTORY_INFO will be received, resulting in consumption Many bandwidth resources, this network packet is a request type used in the SMB protocol to retrieve directory item information, including metadata such as file name, size, timestamp, etc.

In order to optimize performance in such situations, there are several improvement methods you can refer to:

1. Ensure sufficient network bandwidth, which is particularly important for the transmission and enumeration of a large number of small files.

2. Try to avoid placing too many small files in a single directory. You can consider reorganizing the file structure to reduce the number of files in a single directory.

3. Minimize unnecessary enumeration operations.

Related question links:Cause of Excessive SMB2 FIND Requests When Writing Files to a Windows - Microsoft Community

Hope the above information can be helpful to you!

Best regards

Zunhui

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated June 7, 2024 Views 44 Applies to: