IIS Application Memory Limits with FastCGI RRS feed

  • Question

  • User-1196489288 posted

    I am trying to set a memory limit on my application pool so that a user cannot exceed that set amount. If I set the application pool Private Memory Limit to 0 for example (unlimited) and set Max. Instances for the FastCGI process (PHP) to 0 (unlimited) and send it about 250 users I see about 10-12 php-cgi.exe processes in server explorer taking up about 20MB each so around 250MB in use and the w3wp.exe is about 20MB as well however when I'm using Resource Monitor the worker_processes total memory for that application pool is like 43MB which is not even near what I'm seeing in task manager. Thoughts?

    Friday, January 24, 2020 10:38 PM

All replies

  • User690216013 posted

    what I'm seeing in task manager.

    By default Task Manager shows you something called active private working set, which is probably not what you observed in Resource Monitor. Posts like https://dzone.com/articles/windows-process-memory-usage-demystified have more details.

    Saturday, January 25, 2020 12:46 AM
  • User-1196489288 posted

    Understood. My question was more related to does IIS memory usage keep track of FastCGI processes that it can spawn. It seems it does at this time. It's not visible however in the IIS API or within IIS Worker Processes but it does seem to keep track. Would be nice if the IIS team would update the API to show memory usage from FastCGI processes which at this time it does not. For example if I set an application pool to limit 128MB of memory and spawn the site with say 10 FastCGI PHP processes each at around 20MB. If I look at the API and request the memory usage for that worker process it only shows the 17MB w3wp.exe usage as well as if you look in IIS under Worker Processes however after a few seconds it will recycle and log the event in Event Viewer. So again it does keep track of this but it DOES NOT show this info in the API or in IIS which it should for us programmers that want to monitor that.

    Can the IIS team confirm this?

    Saturday, January 25, 2020 4:42 AM
  • User690216013 posted

    My question was more related to does IIS memory usage keep track of FastCGI processes that it can spawn. It seems it does at this time.

    There is no IIS setting to track php-cgi.exe memory footprint, https://docs.microsoft.com/en-us/iis/configuration/system.webserver/fastcgi/application/#configuration and the application pool settings only apply to w3wp.exe.

    Therefore, you can only limit memory usage of php-cgi.exe using PHP settings, https://www.php.net/manual/en/ini.core.php

    Saturday, January 25, 2020 5:42 PM
  • User-1744950148 posted

    Thanks for that link Lex Li. Which of those PHP settings in the article you referred to do you use to limit memory usage of php-cgi.exe?

    The "Max Instances" setting in the IIS FastCGI Aoplication setting allows you to control how many FastCGI processes can be launched. But can you limit the amount of memory each process can consume?

    Friday, February 28, 2020 12:18 PM