0

We recently had a ASP.NET web application (running in a 32-bit application pool), which was running well for years without problems, fill its log with OutOfMemoryExceptions. Recycling the application pool fixed the issue.

I am aware the the correct long-term solution is to

  • find, identify and fix any memory leaks, and
  • migrate the application to 64 bit and provide more memory, if needed.

Until that is done, I want to at least keep the service available. Fortunately, application pools in IIS conveniently allow me to configure a "Private Memory Limit (KB)" and a "Virtual Memory Limit (KB)", which cause the application pool to be recycled automatically, once those limits are reached.

I want to set those options to values which are

  • as high as possible, to avoid unnecessary application pool recycle operations, but
  • as low as necessary to prevent OutOfMemoryExceptions.

Since 32-bit applications can use at most 2GB of virtual memory, I'd ... just set both options to slightly below 2GB? Is it really that simple or am I missing something?

Heinzi
  • 167,459
  • 57
  • 363
  • 519
  • 1
    For IIS w3wp.exe, it can use up to 4GB of memory in a 64bit OS. But I would suggest monitoring your system before setting any values. The garbage collector will run more aggressively when it is closer to the memory usage limit. That may cause excessive CPU utilization. – Eldar Apr 22 '20 at 13:20
  • @Eldar: Thanks, that explains why virtual memory for this worker process is currently at more than 2 GB (which puzzled me extremely). – Heinzi Apr 22 '20 at 13:53
  • An ASP.NET web app should not exceed roughly 1.3 GB (you might check posts like https://stackoverflow.com/questions/14186256/net-out-of-memory-exception-used-1-3gb-but-have-16gb-installed). – Lex Li Apr 22 '20 at 15:03

0 Answers0