2

I created a Windows-based application to monitor the file changes from network-shared folders using .NET FileSystemWatcher. The Application is running on AWS EC2 ts.large Windows Server 2016 Datacenter, 8 GB RAM.

The application works well when monitoring 500 network shared folders, but it constantly raises the exception as below when monitoring 1000 network shared folders.

System.ComponentModel.Win32Exception (0x80004005): Insufficient system resources exist to complete the requested service

In Windows Task Manager, it shows high CPU usage up to 70 - 90% even no any file change in the folders, the RAM looks normal, around 120 MB.

Additionally, if I use the application to monitor 1000 local folder. It works well without any issue.

I guess it might be related to how Windows manages the memory (non-paged memory). But I am not sure exactly how to fix this issue. Very appreciate your suggestion!

Liang Wu
  • 1,772
  • 3
  • 18
  • 26
  • See [related](https://stackoverflow.com/q/151804/1997232). You didn't show any code, so 70-90% CPU should be something else. How did you figure out it's a FSW? – Sinatr Mar 16 '21 at 16:07
  • Thanks, @Sinatr. The application code is quite simple. Not much different than [sample code](https://learn.microsoft.com/en-us/dotnet/api/system.io.filesystemwatcher?view=net-5.0) in MSND. I know it is not reliable when monitoring UNC. I have regular scanning approach to cover that. My question is if my issue is related with the Windows OS and how to tweak that. – Liang Wu Mar 16 '21 at 17:09

0 Answers0