IIS 7 and Above
IIS Application Memory Limits with FastCGI
Last post Feb 28, 2020 12:18 PM by DiamondEagle
Jan 24, 2020 10:38 PM|ryankekos|LINK
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?
Jan 25, 2020 12:46 AM|lextm|LINK
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
Jan 25, 2020 04:42 AM|ryankekos|LINK
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?
Jan 25, 2020 05:42 PM|lextm|LINK
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
Feb 28, 2020 12:18 PM|DiamondEagle|LINK
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?