IIS and PAE
I recently got a question by one of my customers about PAE and IIS that I thought I’d share the answer to.
Their environment looked something like this:
- 32bit OS (Windows 2003)
- IIS 6 with multiple application pools, where each app pool hosts a number of applications
- ~20 GB RAM
They were having problems with out of memory exceptions and also with paging under high load. They knew a lot about their application and memory usage in general, so they knew what they were using the memory for and why they got the OOMs, in this case, memory usage was relatively high per application (intentionally), but it remained stable so no leak. With this in mind, we discussed solutions to the OOMs like splitting up the applications further etc. to avoid this. Now their question was:
Is IIS 6 PAE aware, i.e. will we be using the full 20 GB of RAM or only 4 GB?
I didn’t really know much about this so I consulted with one of our IIS escalation engineers Andreas to get the scoop.
The answer is that IIS 6 is not PAE aware, and since they are running on W2k3 x86 which will not manage memory above 4GB they will effectively only use 4 GB, leaving 16 GB unused. (Unless of course they run other PAE aware apps on it, SQL server for example I believe is PAE aware).
Update: As per Dave’s comments below the statement above seems to be incorrect, if you have multiple w3wp.exe processes they can have a total working set bigger than 4GB (combined for all w3wp.exe processes) even on 32-bit if /PAE is on… So in retrospect, I suspect that the above statement is talking about RAM used for HTTP.SYS etc. This should teach me to not blog about things that I’m only hearing 2nd hand:) even still, it has been a good learning experience for me… and thanks to blogging about it, I now know more… Thanks Dave for commenting on it.
On the other hand, a solution that would solve both the RAM question and the OOM issue is to move to a 64bit OS (preferably 2008 R2 because of improvements in the kernel, memory management and IO management).
Since it is a 64bit OS it can take advantage of all of the RAM, and even if you run 32bit IIS, you can then address 4 GB of Virtual Memory rather than 2 GB which means that there is more room for memory usage before an OOM (in this case since memory usage was stable but relatively high, that is exactly what we want). In fact, as Bernard Cheah also mentions in the same thread, there is no reason to move to 64bit IIS unless you need to, i.e. unless you need to use even more memory than the 4GB of virtual bytes that the 32bit process can address.
Have a good one, Tess