We want to create a webfarm for running our web application.For this we have used filesystemwatcher to get change notice and sync the changes of one server to other servers on webfarm.The filesystemwatcher works watches and notifies when one or two files are added but stops notifying when large number of files are added to the directory.We would be grateful if the best solution is suggested.
FileSystemWatcher not working properly when large number of files are added to the watched directory
Asked
Active
Viewed 353 times
0
-
I strongly suspect that "stops notifying when large number of files..." is not quite true (likely because you synchronously try to sync files when one added), but it does not matter... Replication is non-trivial problem and just knowing when update happened on one machine is not enough (i.e. due to server restarts). Consider searching for existing file synchronization frameworks... For some entertainment reading - [PAXOS](http://en.wikipedia.org/wiki/Paxos_algorithm) may be used to achieve perfect state... – Alexei Levenkov Oct 23 '13 at 06:12
1 Answers
1
FileSystemWatcher has a buffer for notification data, and that buffer is quite small. Its size can be increased, but there will always be a limit for the buffer.
FileSystemWatcher has other disadvantages which make it inappropriate to your job. It would be a better idea to use some other mechanisms for tracking changes and/or, as suggested in the comment, use some existing synchronization framework.

Eugene Mayevski 'Callback
- 45,135
- 8
- 71
- 121